annotate oscgroups/OscGroupServerStartStop.sh @ 101:52e44ee1c791 tip master

enabled all scores in autostart script
author Rob Canning <rc@kiben.net>
date Tue, 21 Apr 2015 16:20:57 +0100
parents 0ae87af84e2f
children
rev   line source
rob@76 1 #! /bin/sh
rob@76 2 #
rob@76 3 # This is a start/stop script to be used with the Linux init.d mechanism
rob@76 4 # so that the OSCgroups server is restarted when Linux is restarted.
rob@76 5 # To use this script, first edit the lines below so that OSCGROUPSERVER
rob@76 6 # is the path to the OscGroupServer binary and LOGFILE is the path to
rob@76 7 # a file where the server will write log messages. The PORT, MAXUSERS,
rob@76 8 # MAXGROUPS and TIMEOUTSECONDS variables map to the corresponding
rob@76 9 # OscGroupServer parameters. You can also edit the USER variable to
rob@76 10 # execute the server as a different Unix user.
rob@76 11 #
rob@76 12 # to install this script place it in /etc/init.d (or link it using ln -s)
rob@76 13 #
rob@76 14 # then add it to the global startup/shutdown scripts using:
rob@76 15 #
rob@76 16 # $ update-rc.d OscGroupServerStartStop.sh defaults
rob@76 17 #
rob@76 18 # you can also run it manually using:
rob@76 19 #
rob@76 20 # $ OscGroupServerStartStop.sh start
rob@76 21 #
rob@76 22 # for more info see:
rob@76 23 # man start-stop-daemon
rob@76 24 # man update-rc.d
rob@76 25 # cat /etc/init.d/skeleton
rob@76 26 #
rob@76 27
rob@76 28 OSCGROUPSERVER=/root/oscgroups/OSCgroups/bin/OscGroupServer
rob@76 29 LOGFILE=/root/logs/oscgroupserver.log
rob@76 30 PORT=22242
rob@76 31 TIMEOUTSECONDS=60
rob@76 32 MAXUSERS=500
rob@76 33 MAXGROUPS=500
rob@76 34
rob@76 35 PATH=/sbin:/bin:/usr/sbin:/usr/bin
rob@76 36 DAEMON=$OSCGROUPSERVER
rob@76 37 NAME="OscGroupServer"
rob@76 38 DESC="OscGroupServer: OSCgroups NAT traversal daemon"
rob@76 39 OPTIONS="-l $LOGFILE";
rob@76 40 USER=root
rob@76 41 PIDFILE=/var/run/$NAME.pid
rob@76 42 STOPSIGNAL=INT
rob@76 43
rob@76 44 test -x $DAEMON || echo Error: $DAEMON missing or not executable
rob@76 45 test -x $DEAMON || exit 0
rob@76 46
rob@76 47 set -e
rob@76 48
rob@76 49
rob@76 50 d_start() {
rob@76 51 start-stop-daemon --start --background --make-pidfile --pidfile $PIDFILE \
rob@76 52 --chuid $USER --exec $DAEMON -- $OPTIONS
rob@76 53 }
rob@76 54
rob@76 55 d_stop() {
rob@76 56 start-stop-daemon --stop --pidfile $PIDFILE \
rob@76 57 --signal $STOPSIGNAL
rob@76 58 }
rob@76 59
rob@76 60 case "$1" in
rob@76 61 start)
rob@76 62 echo -n "Starting $DESC: $NAME"
rob@76 63 d_start
rob@76 64 echo "."
rob@76 65 ;;
rob@76 66 stop)
rob@76 67 echo -n "Stopping $DESC: $NAME"
rob@76 68 d_stop
rob@76 69 echo "."
rob@76 70 ;;
rob@76 71
rob@76 72 restart|force-reload)
rob@76 73 echo -n "Restarting $DESC: $NAME"
rob@76 74 d_stop
rob@76 75 sleep 1
rob@76 76 d_start
rob@76 77 echo "."
rob@76 78 ;;
rob@76 79 *)
rob@76 80 echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload}" >&2
rob@76 81 exit 1
rob@76 82 ;;
rob@76 83 esac
rob@76 84
rob@76 85 exit 0
rob@76 86