aboutsummaryrefslogtreecommitdiffstats
path: root/test/utils/catchsignal.sh
diff options
context:
space:
mode:
Diffstat (limited to 'test/utils/catchsignal.sh')
-rwxr-xr-xtest/utils/catchsignal.sh27
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
20trap _term SIGTERM
21trap _term SIGINT
22
23echo "Sleeping..."
24
25sleep inf &
26pid=$!
27wait $pid