Merge pull request #5714 from alexischr/update_bockbuild
[mono.git] / scripts / mono-service.in
1 #!/bin/sh
2 args=""
3 assembly=
4 debug=false
5 while test x$1 != x; do
6         case $1 in
7                 -[ldnm]:*) args="$args$1 " ;;
8                 --debug) debug=true ;;
9                 --no-daemon) debug=true ;;
10                 *) assembly=$1;  args="$args$assembly ";;
11         esac
12         shift
13 done
14
15 if test x$assembly = x; then
16         echo You must specify at least the assembly name
17         echo 
18         echo "Usage is: $0 [options] service"
19         echo 
20         echo '    -d:<directory>         Working directory'
21         echo '    -l:<lock file>         Lock file (default is /tmp/<service>.lock)'
22         echo '    -m:<syslog name>       Name to show in syslog'
23         echo '    -n:<service name>      Name of service to start (default is first defined)'
24         echo '    --debug                Do not send to background nor redirect input/output'
25         echo '    --no-daemon            Do not send to background nor redirect input/output'
26         echo 
27         echo Controlling the service:
28         echo 
29         echo '    kill -USR1 `cat <lock file>`    Pausing service'
30         echo '    kill -USR2 `cat <lock file>`    Continuing service'
31         echo '    kill `cat <lock file>`          Ending service'
32         echo 
33         exit 1
34 fi
35
36 export MONO_DISABLE_SHM=1
37 if $debug; then
38    exec @bindir@/@mono_interp@ $MONO_OPTIONS @mono_instdir@/@framework_version@/mono-service.exe $args
39 else
40    exec @bindir@/@mono_interp@ $MONO_OPTIONS @mono_instdir@/@framework_version@/mono-service.exe $args </dev/null >/dev/null 2>&1 &
41 fi