Merge pull request #5714 from alexischr/update_bockbuild
[mono.git] / scripts / mono-service.in
index 6cc174c7d3b1d7cbcba903af56241926bc6fe503..f86087ec9c8c3e7425181222610fd173474c18fd 100644 (file)
@@ -1,20 +1,41 @@
 #!/bin/sh
-args="$@"
+args=""
 assembly=
+debug=false
 while test x$1 != x; do
        case $1 in
-               -[ldnm]:*) ;;
-               *) assembly=$1;;
+               -[ldnm]:*) args="$args$1 " ;;
+               --debug) debug=true ;;
+               --no-daemon) debug=true ;;
+               *) assembly=$1;  args="$args$assembly ";;
        esac
        shift
 done
 
 if test x$assembly = x; then
        echo You must specify at least the assembly name
-       echo Usage is:
-       echo mono-service [-d:DIRECTORY] [-l:LOCKFILE] [-n:NAME] [-m:LOGNAME] service.exe
+       echo 
+       echo "Usage is: $0 [options] service"
+       echo 
+       echo '    -d:<directory>         Working directory'
+       echo '    -l:<lock file>         Lock file (default is /tmp/<service>.lock)'
+       echo '    -m:<syslog name>       Name to show in syslog'
+       echo '    -n:<service name>      Name of service to start (default is first defined)'
+        echo '    --debug                Do not send to background nor redirect input/output'
+        echo '    --no-daemon            Do not send to background nor redirect input/output'
+       echo 
+       echo Controlling the service:
+       echo 
+       echo '    kill -USR1 `cat <lock file>`    Pausing service'
+       echo '    kill -USR2 `cat <lock file>`    Continuing service'
+       echo '    kill `cat <lock file>`          Ending service'
+       echo 
        exit 1
 fi
 
 export MONO_DISABLE_SHM=1
-exec @bindir@/@mono_interp@ @mono_one_instdir@/@exe_file@ "$args" </dev/null >& /dev/null
\ No newline at end of file
+if $debug; then
+   exec @bindir@/@mono_interp@ $MONO_OPTIONS @mono_instdir@/@framework_version@/mono-service.exe $args
+else
+   exec @bindir@/@mono_interp@ $MONO_OPTIONS @mono_instdir@/@framework_version@/mono-service.exe $args </dev/null >/dev/null 2>&1 &
+fi