Comment 1 for bug 716987

Revision history for this message
felix-kunsmann (felix-kunsmann-shroudbnc) wrote :

#!/bin/bash
# Initscript for sBNC
# Author: Axel 'shenziro' Hartwig

### Config ###

# Change UID/GID after starting to <uid|username>[:<gid:groupname>]
CHANGEUIDGID="ircstuff:ircstuff"

# Path to the program (not the name of the executeable; no trailing slash)
PROGPATH="/home/opt/sbnc1.3"

# Name of the executeable in $PROGPATH
PROGEXEC="sbnc"

# Program parameters
PROGPARAMS=""

# Name of the program (only used to display it during start/stop in this script)
PROGNAME="sBNC"

### Script ###

function do_start {
        echo -n "Starting $PROGNAME: "

        start-stop-daemon --start -c $CHANGEUIDGID -b -d $PROGPATH -x $PROGPATH/$PROGEXEC -- $PROGPARAMS

        returnval=$?
        if [ $returnval == 0 ]; then
                echo "OK."
        else
                exit 1
        fi
}

function do_stop {
        echo -n "Stopping $PROGNAME: "

        start-stop-daemon --stop -d $PROGPATH -x $PROGPATH/$PROGEXEC

        returnval=$?
        if [ $returnval == 0 ]; then
                echo "OK."
        else
                exit 1
        fi
}

case $1 in
        start)
                do_start
                ;;
        stop)
                do_stop
                ;;
        restart)
                do_stop
                do_start
                ;;
        *)
                echo "Usage: $0 {start|stop|restart}" >&2
                exit 1
                ;;
esac