-
Notifications
You must be signed in to change notification settings - Fork 4
32 lines (32 loc) · 993 Bytes
/
test-daemonize.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
name: Test daemonized worker
on:
- workflow_dispatch
jobs:
daemonize-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: daemonize return immediately
run: |
# Run the signal-ignoring utility script as a detached
# daemonized process, trying to disown it completely.
# It's probably sufficient to ( ./signaller.py & )
# but setsid is more explicit and robust.
setsid --fork python3 ./signaller.py SIGINT
- name: look for pid file
run: |
while ! [ -e signaller.pid ]; do sleep 1; done
cat signaller.pid
ps -f -p "$(cat signaller.pid)"
# we'll leave it running
- name: wait a while
run: |
sleep 200
- name: check pid again
run: |
ps -f -p "$(cat signaller.pid)"
# wonder how long it'll stay alive?
- if: always()
run: |
cat signaller.log
ps -efH