1628
|
1 #!/bin/bash
|
|
2
|
|
3 . check_app.sh;
|
|
4
|
|
5 #seconds to wait
|
|
6 toWait=30;
|
|
7 i=0;
|
|
8
|
|
9 getPids;
|
|
10
|
|
11 if [ "$PIDS" != "" ]; then
|
|
12 while [ $i -lt $toWait ]; do
|
|
13 kill -TERM $PIDS;
|
|
14 sleep 1;
|
|
15 getPids;
|
|
16 if [ "$PIDS" == "" ]; then
|
|
17 break
|
|
18 fi;
|
|
19 let i=$i+1;
|
|
20 done;
|
|
21
|
|
22 if [ "$PIDS" != "" ]; then
|
|
23 echo "Can't stop app in ${i} seconds";
|
|
24 exit 0;
|
|
25 else
|
|
26 rm started.lock;
|
|
27 echo "App stopped";
|
|
28 fi;
|
|
29 else
|
|
30 echo "no running app found";
|
|
31 fi;
|
|
32
|
|
33 #sudo /usr/local/bin/nginx -s stop;
|
|
34 exit 0;
|