rob@76: #! /bin/sh rob@76: # rob@76: # This is a start/stop script to be used with the Linux init.d mechanism rob@76: # so that the OSCgroups server is restarted when Linux is restarted. rob@76: # To use this script, first edit the lines below so that OSCGROUPSERVER rob@76: # is the path to the OscGroupServer binary and LOGFILE is the path to rob@76: # a file where the server will write log messages. The PORT, MAXUSERS, rob@76: # MAXGROUPS and TIMEOUTSECONDS variables map to the corresponding rob@76: # OscGroupServer parameters. You can also edit the USER variable to rob@76: # execute the server as a different Unix user. rob@76: # rob@76: # to install this script place it in /etc/init.d (or link it using ln -s) rob@76: # rob@76: # then add it to the global startup/shutdown scripts using: rob@76: # rob@76: # $ update-rc.d OscGroupServerStartStop.sh defaults rob@76: # rob@76: # you can also run it manually using: rob@76: # rob@76: # $ OscGroupServerStartStop.sh start rob@76: # rob@76: # for more info see: rob@76: # man start-stop-daemon rob@76: # man update-rc.d rob@76: # cat /etc/init.d/skeleton rob@76: # rob@76: rob@76: OSCGROUPSERVER=/root/oscgroups/OSCgroups/bin/OscGroupServer rob@76: LOGFILE=/root/logs/oscgroupserver.log rob@76: PORT=22242 rob@76: TIMEOUTSECONDS=60 rob@76: MAXUSERS=500 rob@76: MAXGROUPS=500 rob@76: rob@76: PATH=/sbin:/bin:/usr/sbin:/usr/bin rob@76: DAEMON=$OSCGROUPSERVER rob@76: NAME="OscGroupServer" rob@76: DESC="OscGroupServer: OSCgroups NAT traversal daemon" rob@76: OPTIONS="-l $LOGFILE"; rob@76: USER=root rob@76: PIDFILE=/var/run/$NAME.pid rob@76: STOPSIGNAL=INT rob@76: rob@76: test -x $DAEMON || echo Error: $DAEMON missing or not executable rob@76: test -x $DEAMON || exit 0 rob@76: rob@76: set -e rob@76: rob@76: rob@76: d_start() { rob@76: start-stop-daemon --start --background --make-pidfile --pidfile $PIDFILE \ rob@76: --chuid $USER --exec $DAEMON -- $OPTIONS rob@76: } rob@76: rob@76: d_stop() { rob@76: start-stop-daemon --stop --pidfile $PIDFILE \ rob@76: --signal $STOPSIGNAL rob@76: } rob@76: rob@76: case "$1" in rob@76: start) rob@76: echo -n "Starting $DESC: $NAME" rob@76: d_start rob@76: echo "." rob@76: ;; rob@76: stop) rob@76: echo -n "Stopping $DESC: $NAME" rob@76: d_stop rob@76: echo "." rob@76: ;; rob@76: rob@76: restart|force-reload) rob@76: echo -n "Restarting $DESC: $NAME" rob@76: d_stop rob@76: sleep 1 rob@76: d_start rob@76: echo "." rob@76: ;; rob@76: *) rob@76: echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload}" >&2 rob@76: exit 1 rob@76: ;; rob@76: esac rob@76: rob@76: exit 0 rob@76: