-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvalve.sh
executable file
·47 lines (40 loc) · 913 Bytes
/
valve.sh
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#!/bin/bash
counter=0
function terminate {
kill -SIGINT $PROC1 2>/dev/null
kill -SIGTERM $PROC1 2>/dev/null
echo -e "\e[33m\n\n"
echo -e "-----------------------------"
echo -e " OMX TERMINATED. "
echo -e "-----------------------------"
echo -e "\n\n"
trap SIGTERM
trap SIGINT
kill -SIGTERM $$ 2>/dev/null
}
trap terminate SIGINT
# trap 'echo int; kill -SIGINT $PROC1' SIGINT
trap terminate SIGTERM
function looping {
while true; do
echo -e "\e[34m"
echo "-----------------------------"
echo " Starting omx. "
echo "-----------------------------"
echo ""
echo ""
./omx.sh &
PROC2=$!
trap 'kill -SIGINT $PROC2; trap SIGINT; break' SIGINT
trap 'kill -SIGINT $PROC2; trap SIGTERM; break' SIGTERM
wait
echo ""
counter=$(expr $counter + 1)
echo "Error. Retrying. Rerun #$counter."
echo ""
sleep 5
done
}
looping &
PROC1=$!
wait