]> arthur.barton.de Git - ngircd-alex.git/blob - contrib/Debian/ngircd.init
Updated debian changelog.
[ngircd-alex.git] / contrib / Debian / ngircd.init
1 #!/bin/sh
2 #
3 # ngIRCd start and stop script for Debian-based systems
4 #
5 # $Id: ngircd.init,v 1.6 2005/07/26 19:37:18 alex Exp $
6 #
7
8 PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
9 DAEMON=/usr/sbin/ngircd
10 NAME=ngIRCd
11 DESC="IRC daemon"
12 PARAMS=""
13
14 test -h "$0" && me=`readlink $0` || me="$0"
15 BASENAME=`basename $me`
16
17 test -f /etc/default/$BASENAME && . /etc/default/$BASENAME
18
19 test -x $DAEMON || exit 0
20
21 Check_Config()
22 {
23         $DAEMON --configtest >/dev/null 2>&1
24         if [ $? -ne 0 ]; then
25                 echo "Configuration of $NAME is not valide, won't (re)start!"
26                 echo "Please run \"$DAEMON --configtest\" manually and fix it up ..."
27                 exit 1
28         fi
29 }
30
31 Try_Start()
32 {
33         [ ! -d /var/run/ircd ] || chown irc:irc /var/run/ircd
34         start-stop-daemon --start --quiet --exec $DAEMON -- $PARAMS
35         if [ $? -ne 0 ]; then
36                 echo "$NAME failed!"
37                 exit 1
38         fi
39         echo "$NAME."
40 }
41
42 case "$1" in
43   start)
44         Check_Config
45         echo -n "Starting $DESC: "
46         Try_Start
47         ;;
48   stop)
49         echo -n "Stopping $DESC: "
50         start-stop-daemon --stop --quiet --pidfile /var/run/ircd/ngircd.pid --exec $DAEMON \
51           && echo "$NAME." \
52           || echo "(none running)"
53         ;;
54   reload|force-reload)
55         Check_Config
56         echo "Reloading $DESC configuration files."
57         start-stop-daemon --stop --signal 1 --quiet --exec $DAEMON
58         ;;
59   restart)
60         Check_Config
61         echo -n "Restarting $DESC: "
62         start-stop-daemon --stop --quiet --oknodo --exec $DAEMON
63         sleep 1
64         Try_Start
65         ;;
66   *)
67         N=/etc/init.d/$NAME
68         echo "Usage: $N {start|stop|restart|reload|force-reload}" >&2
69         exit 1
70         ;;
71 esac
72
73 exit 0
74
75 # -eof-