annotate host/start.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 #!/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;
1633
665049cffc02 fix path
fffilimonov
parents: 1630
diff changeset
17 sudo $(which nginx) -c $(pwd)/local/nginx.conf;
1628
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;