annotate host/start.sh @ 1628:520707a70379

add host
author Franklin Schmidt <fschmidt@gmail.com>
date Tue, 07 Dec 2021 23:29:58 -0700
parents
children b735ed134662
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 set -e
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=10;
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 . check_app.sh;
520707a70379 add host
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
10 checkStopped;
520707a70379 add host
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
11
520707a70379 add host
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
12 . luan string:;
520707a70379 add host
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
13
520707a70379 add host
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
14 mkdir -p logs 2>/dev/null;
520707a70379 add host
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
15
520707a70379 add host
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
16 touch started.lock;
520707a70379 add host
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
17
520707a70379 add host
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
18 if [ "$1" == "launchd" ]; then
520707a70379 add host
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
19 java -Xms1024M -classpath $CLASSPATH luan.Luan run.luan logs 1>logs/stdout.log 2>logs/stderr.log
520707a70379 add host
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
20 else
520707a70379 add host
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
21 java -Xms1024M -classpath $CLASSPATH luan.Luan run.luan logs 1>logs/stdout.log 2>logs/stderr.log &
520707a70379 add host
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
22
520707a70379 add host
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
23 getPids;
520707a70379 add host
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
24 if [ "$PIDS" == "" ]; then
520707a70379 add host
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
25 while [ $i -lt $toWait ]; do
520707a70379 add host
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
26 sleep 1;
520707a70379 add host
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
27 getPids;
520707a70379 add host
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
28 if [ "$PIDS" != "" ]; then
520707a70379 add host
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
29 break
520707a70379 add host
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
30 fi;
520707a70379 add host
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
31 let i=$i+1;
520707a70379 add host
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
32 done;
520707a70379 add host
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
33 fi;
520707a70379 add host
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
34
520707a70379 add host
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
35 checkRunning;
520707a70379 add host
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
36 fi;
520707a70379 add host
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
37
520707a70379 add host
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
38 #sudo /usr/local/bin/nginx -c $(pwd)/local/nginx.conf;