Correct PPTP server firewall rules chain.
[tomato/davidwu.git] / release / src / router / nocat / libexec / iptables / call_splashd_check.sh
blob75fca107204be98741cf95132b82f3c79dca89a9
1 #!/bin/sh
2 export PATH=/tmp/sbin:/tmp/bin:/bin:/usr/bin:/sbin:/usr/sbin
4 SPLASHD_ENABLED=`/bin/nvram get NC_enable`
5 if [ $SPLASHD_ENABLED -gt 0 ]; then
7 # verbosity
8 VERBOSITY=`/bin/nvram get NC_Verbosity`
10 # CHECK_TIMEOUT=`/bin/nvram get NC_check_timeout`
11 CHECK_TIMEOUT=10
13 if [ $VERBOSITY -gt 4 ]; then /usr/bin/logger "check splashd: call with timeout: $CHECK_TIMEOUT"; fi
15 MY_PID=$$
17 (/bin/sleep $CHECK_TIMEOUT ; /bin/kill -1 $MY_PID) &
18 CONTROL_PID=$!
20 /usr/libexec/nocat/check_splashd.sh &
21 CHECK_PID=$!
23 if [ $VERBOSITY -gt 4 ]; then
24 trap "/usr/bin/logger check splashd: TIMEOUT, stop check and splashd ; /bin/kill $CHECK_PID ; /bin/killall splashd; /bin/sleep 15; /usr/bin/logger check splashd: restart splashd ; /usr/sbin/splashd >> /tmp/services.out 2>&1 & ; /bin/kill $MY_PID " 1
25 else
26 trap "/bin/kill $CHECK_PID ; /bin/killall splashd; /bin/sleep 15; /usr/sbin/splashd >> /tmp/services.out 2>&1 & ; /bin/kill $MY_PID " 1
29 wait $CHECK_PID
30 #kill the controlling process,
31 #we can do that as it must still exist, becuase on timeout we would have been killed already by the trap above via control
32 kill $CONTROL_PID