initscript for sBNC

Bug #716987 reported by felix-kunsmann
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
shroudBNC
In Progress
Wishlist
Gunnar Beutner

Bug Description

Create an initscript for sBNC which can be used to automatically start sBNC via /etc/init.d or something.

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

Revision history for this message
Gunnar Beutner (gunnarbeutner) wrote :

Starting sbnc using crontab might be much easier, especially since using an init script would require root privileges (i.e. in order to add / update the usernames):

@reboot /path/for/sbnc --config /path/for/configdir &>/dev/null

1.3 locks its config dir, so it might even be possible to 'check' whether a particular instance is running:

*/10 * * * * /path/for/sbnc --config /path/for/configdir &>/dev/null

This would check (and possibly restart sbnc) every 10 minutes.

Need to figure out which approach is better (crontab/initscript) and update the documentation accordingly.

tags: added: compilation-and-installation
Changed in shroudbnc:
importance: Medium → Wishlist
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.