Automatic commit of irc logs
[matches/MCTX3420.git] / server / run.sh
index d4e6510..1890059 100755 (executable)
@@ -6,13 +6,16 @@ if [ ! -e "server" ]; then
         exit 1
 fi
 
+# Get the parameters
+. parameters
+echo "Parameters are: $parameters"
 
 if [[ "$(uname -m)" != *arm*  ]]; then
         echo Not running on the BBB
         # Use this to quickly test run the server in valgrind
-        spawn-fcgi -p9005 -n ./valgrind.sh
+        #spawn-fcgi -p9005 -n ./valgrind.sh
         # Use this to run the server normally
-        #spawn-fcgi -p9005 -n ./server
+        spawn-fcgi -p9005 -n -- ./server $parameters
         exit 0
 fi
 
@@ -75,16 +78,16 @@ fi;
 #adc_device_path=$(dirname $(find /sys -name *AIN0))
 
 
-# Get the parameters
-. parameters
 
-echo "Parameters are: $parameters"
 
 # Run the program with parameters
 # TODO: Can tell spawn-fcgi to run the program as an unprivelaged user?
 # But first will have to work out how to set PWM/GPIO as unprivelaged user
+# NOTE: Having the program automatically restart itself after a *FATAL ERROR* doesn't seem like such a good idea now
+# (Some things that call Fatal happen under circumstances where they will just keep calling Fatal every time the program starts)
+# Change the number of fails to 1 for now. We can potentially use different error codes for different types of errors, but that seems overkill.
 fails=0
-while [ $fails -lt 10 ]; do
+while [ $fails -lt 1 ]; do
         spawn-fcgi -p9005 -n -- ./server $parameters
                error=$?
         if [ "$error" == "0" ]; then

UCC git Repository :: git.ucc.asn.au