+fails=0
+while [ $fails -lt 10 ]; do
+ spawn-fcgi -p9005 -n -- ./server -a "$adc_device_path"
+ if [ "$?" == "0" ]; then
+ exit 0
+ fi
+ fails=$(( $fails + 1 ))
+ (echo "Restarting server after Fatal Error #$fails") 1>&2
+
+done
+(echo "Server had too many Fatal Errors ($fails)") 1>&2
+exit $fails
+