annotate host/check_app.sh @ 1789:bac27b119ff2

exit code 1 on exception
author Franklin Schmidt <fschmidt@gmail.com>
date Sun, 24 Dec 2023 16:52:35 -0700
parents 665049cffc02
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 PIDS="";
520707a70379 add host
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
2
1633
665049cffc02 fix path
fffilimonov
parents: 1628
diff changeset
3 export PATH="$PATH:/usr/local/bin";
665049cffc02 fix path
fffilimonov
parents: 1628
diff changeset
4
1628
520707a70379 add host
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
5 function getPids() {
520707a70379 add host
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
6 PIDS=$(ps ax | awk '{if($0~"[r]un.luan"){print $1}}');
520707a70379 add host
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
7 }
520707a70379 add host
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
8
520707a70379 add host
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
9 function checkStopped() {
520707a70379 add host
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
10 getPids;
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 echo "App already running";
520707a70379 add host
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
13 exit 0;
520707a70379 add host
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
14 fi;
520707a70379 add host
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
15 }
520707a70379 add host
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
16
520707a70379 add host
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
17 function checkRunning() {
520707a70379 add host
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
18 getPids;
520707a70379 add host
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
19 if [ "$PIDS" != "" ]; then
520707a70379 add host
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
20 echo "App running";
520707a70379 add host
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
21 else
520707a70379 add host
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
22 echo "App not running";
520707a70379 add host
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
23 exit 0;
520707a70379 add host
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
24 fi;
520707a70379 add host
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
25 }