diff host/check_app.sh @ 1628:520707a70379

add host
author Franklin Schmidt <fschmidt@gmail.com>
date Tue, 07 Dec 2021 23:29:58 -0700
parents
children 665049cffc02
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/host/check_app.sh	Tue Dec 07 23:29:58 2021 -0700
@@ -0,0 +1,23 @@
+PIDS="";
+
+function getPids() {
+  PIDS=$(ps ax | awk '{if($0~"[r]un.luan"){print $1}}');
+}
+
+function checkStopped() {
+  getPids;
+  if [ "$PIDS" != "" ]; then
+    echo "App already running";
+    exit 0;
+  fi;
+}
+
+function checkRunning() {
+  getPids;
+  if [ "$PIDS" != "" ]; then
+    echo "App running";
+  else
+    echo "App not running";
+    exit 0;
+  fi;
+}