]> arthur.barton.de Git - ngircd-alex.git/blob - contrib/Debian/ngircd.init
Fxied name of "default file" for ngircd-full package. And do the test if
[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.2 2004/09/06 00:32:20 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 BASENAME=`basename $0`
12 DESC="IRC daemon"
13 PARAMS=""
14
15 test -f /etc/default/$BASENAME && . /etc/default/$BASENAME
16
17 test -x $DAEMON || exit 0
18
19 Check_Config()
20 {
21         $DAEMON --configtest >/dev/null 2>&1
22         if [ $? -ne 0 ]; then
23                 echo "Configuration of $NAME is not valide, won't (re)start!"
24                 echo "Please run \"$DAEMON --configtest\" manually and fix it up ..."
25                 exit 1
26         fi
27 }
28
29 Try_Start()
30 {
31         start-stop-daemon --start --quiet --exec $DAEMON -- $PARAMS
32         if [ $? -ne 0 ]; then
33                 echo "$NAME failed!"
34                 exit 1
35         fi
36         echo "$NAME."
37 }
38
39 case "$1" in
40   start)
41         Check_Config
42         echo -n "Starting $DESC: "
43         Try_Start
44         ;;
45   stop)
46         echo -n "Stopping $DESC: "
47         start-stop-daemon --stop --quiet --exec $DAEMON \
48           && echo "$NAME." \
49           || echo "(none running)"
50         ;;
51   reload|force-reload)
52         Check_Config
53         echo "Reloading $DESC configuration files."
54         start-stop-daemon --stop --signal 1 --quiet --exec $DAEMON
55         ;;
56   restart)
57         Check_Config
58         echo -n "Restarting $DESC: "
59         start-stop-daemon --stop --quiet --oknodo --exec $DAEMON
60         sleep 1
61         Try_Start
62         ;;
63   *)
64         N=/etc/init.d/$NAME
65         echo "Usage: $N {start|stop|restart|reload|force-reload}" >&2
66         exit 1
67         ;;
68 esac
69
70 exit 0
71
72 # -eof-