Skip to content

Commit 43d377f

Browse files
committed
Improve the test worker run script (run_test.sh)
Add some documentation to the script, list the started jobs with the "jobs -l" command and make the script stop only on Ctrl+C (to allow typing to the terminal without killing the workers).
1 parent bfc981f commit 43d377f

File tree

1 file changed

+16
-3
lines changed

1 file changed

+16
-3
lines changed

run_test.sh

+16-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,20 @@
11
#!/bin/bash
2+
# Run the RQ workers in the background for testing purposes.
3+
#
4+
# Note: This script is intended for testing purposes only. In
5+
# production the workers should be started with a process manager like
6+
# systemd.
7+
28
rq worker download_object &
39
rq worker create_sip &
410
rq worker submit_sip &
5-
echo "Press anything to shutdown the workers";
6-
read -n 1
7-
killall -s TERM rq
11+
12+
# Wait a bit for workers to start and stop outputting to console
13+
sleep 1
14+
15+
printf "\nWorkers started:\n%s\n\n" "$(jobs -l)"
16+
printf "Press Ctrl+C to shutdown the workers.\n"
17+
while true; do sleep 10; done
18+
19+
# Note: Workers will stop when the script is terminated with Ctrl+C
20+
# because they are background jobs and the script is the parent process.

0 commit comments

Comments
 (0)