diff host/stop.sh @ 1628:520707a70379

add host
author Franklin Schmidt <fschmidt@gmail.com>
date Tue, 07 Dec 2021 23:29:58 -0700
parents
children b735ed134662
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/host/stop.sh	Tue Dec 07 23:29:58 2021 -0700
@@ -0,0 +1,34 @@
+#!/bin/bash
+
+. check_app.sh;
+
+#seconds to wait
+toWait=30;
+i=0;
+
+getPids;
+
+if [ "$PIDS" != "" ]; then
+  while [ $i -lt $toWait ]; do
+    kill -TERM $PIDS;
+    sleep 1;
+    getPids;
+    if [ "$PIDS" == "" ]; then
+      break
+    fi;
+    let i=$i+1;
+  done;
+
+  if [ "$PIDS" != "" ]; then
+    echo "Can't stop app in ${i} seconds";
+    exit 0;
+  else
+    rm started.lock;
+    echo "App stopped";
+  fi;
+else
+    echo "no running app found";
+fi;
+
+#sudo /usr/local/bin/nginx -s stop;
+exit 0;