diff options
Diffstat (limited to 'test/utils/catchsignal.sh')
-rwxr-xr-x | test/utils/catchsignal.sh | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/test/utils/catchsignal.sh b/test/utils/catchsignal.sh new file mode 100755 index 000000000..87a1d0adf --- /dev/null +++ b/test/utils/catchsignal.sh | |||
@@ -0,0 +1,27 @@ | |||
1 | #!/bin/bash | ||
2 | |||
3 | _term() { | ||
4 | echo "Caught Signal" | ||
5 | echo 1 | ||
6 | sleep 1 | ||
7 | echo 2 | ||
8 | sleep 1 | ||
9 | echo 3 | ||
10 | sleep 1 | ||
11 | echo 4 | ||
12 | sleep 1 | ||
13 | echo 5 | ||
14 | sleep 1 | ||
15 | |||
16 | kill $pid | ||
17 | exit | ||
18 | } | ||
19 | |||
20 | trap _term SIGTERM | ||
21 | trap _term SIGINT | ||
22 | |||
23 | echo "Sleeping..." | ||
24 | |||
25 | sleep inf & | ||
26 | pid=$! | ||
27 | wait $pid | ||