annotate host/stop.sh @ 1807:ffa28e2155bb

add line_diff
author Franklin Schmidt <fschmidt@gmail.com>
date Sun, 12 May 2024 15:25:29 -0600
parents b735ed134662
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1628
520707a70379 add host
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
1 #!/bin/bash
520707a70379 add host
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
2
520707a70379 add host
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
3 . check_app.sh;
520707a70379 add host
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
4
520707a70379 add host
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
5 #seconds to wait
520707a70379 add host
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
6 toWait=30;
520707a70379 add host
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
7 i=0;
520707a70379 add host
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
8
520707a70379 add host
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
9 getPids;
520707a70379 add host
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
10
520707a70379 add host
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
11 if [ "$PIDS" != "" ]; then
520707a70379 add host
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
12 while [ $i -lt $toWait ]; do
520707a70379 add host
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
13 kill -TERM $PIDS;
520707a70379 add host
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
14 sleep 1;
520707a70379 add host
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
15 getPids;
520707a70379 add host
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
16 if [ "$PIDS" == "" ]; then
520707a70379 add host
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
17 break
520707a70379 add host
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
18 fi;
520707a70379 add host
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
19 let i=$i+1;
520707a70379 add host
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
20 done;
520707a70379 add host
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
21
520707a70379 add host
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
22 if [ "$PIDS" != "" ]; then
520707a70379 add host
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
23 echo "Can't stop app in ${i} seconds";
520707a70379 add host
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
24 exit 0;
520707a70379 add host
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
25 else
520707a70379 add host
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
26 rm started.lock;
520707a70379 add host
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
27 echo "App stopped";
520707a70379 add host
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
28 fi;
520707a70379 add host
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
29 else
520707a70379 add host
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
30 echo "no running app found";
520707a70379 add host
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
31 fi;
520707a70379 add host
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
32
1630
b735ed134662 add nginx and ssl for host
fffilimonov
parents: 1628
diff changeset
33 sudo $(which nginx) -s stop;
1628
520707a70379 add host
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
34 exit 0;