| 1628 | 1 #!/bin/bash | 
|  | 2 | 
|  | 3 set -e | 
|  | 4 | 
|  | 5 #seconds to wait | 
|  | 6 toWait=10; | 
|  | 7 i=0; | 
|  | 8 | 
|  | 9 . check_app.sh; | 
|  | 10 checkStopped; | 
|  | 11 | 
|  | 12 . luan string:; | 
|  | 13 | 
|  | 14 mkdir -p logs 2>/dev/null; | 
|  | 15 | 
|  | 16 touch started.lock; | 
| 1633 | 17 sudo $(which nginx) -c $(pwd)/local/nginx.conf; | 
| 1628 | 18 if [ "$1" == "launchd" ]; then | 
|  | 19   java -Xms1024M -classpath $CLASSPATH luan.Luan run.luan logs 1>logs/stdout.log 2>logs/stderr.log | 
|  | 20 else | 
|  | 21   java -Xms1024M -classpath $CLASSPATH luan.Luan run.luan logs 1>logs/stdout.log 2>logs/stderr.log & | 
|  | 22 | 
|  | 23   getPids; | 
|  | 24   if [ "$PIDS" == "" ]; then | 
|  | 25     while [ $i -lt $toWait ]; do | 
|  | 26       sleep 1; | 
|  | 27       getPids; | 
|  | 28       if [ "$PIDS" != "" ]; then | 
|  | 29         break | 
|  | 30       fi; | 
|  | 31       let i=$i+1; | 
|  | 32     done; | 
|  | 33   fi; | 
|  | 34 | 
|  | 35   checkRunning; | 
|  | 36 fi; |