]> Cypherpunks.ru repositories - goircd.git/blob - startup/debian.sh
Various example startup scripts
[goircd.git] / startup / debian.sh
1 #! /bin/sh
2
3 ### BEGIN INIT INFO
4 # Provides:          goircd
5 # Required-Start:    $remote_fs $network
6 # Required-Stop:     $remote_fs $network
7 # Default-Start:     2 3 4 5
8 # Default-Stop:
9 # Short-Description: goircd IRC server
10 # Description:       goircd IRC server
11 ### END INIT INFO
12
13 NAME=goircd
14 DAEMON=/home/goircd/goircd
15 PIDFILE=/var/run/goircd.pid
16
17 . /lib/lsb/init-functions
18
19 case "$1" in
20   start)
21     log_daemon_msg "Starting $NAME daemon" "$NAME"
22     start-stop-daemon --start --quiet --background \
23       --pidfile $PIDFILE --make-pidfile --exec $DAEMON \
24       -- -hostname irc.example.com
25     log_end_msg $?
26     ;;
27   stop)
28     log_daemon_msg "Stopping $NAME daemon" "$NAME"
29     start-stop-daemon --stop --quiet --oknodo --pidfile $PIDFILE
30     log_end_msg $?
31     rm -f $PIDFILE
32     ;;
33   restart)
34     $0 stop || :
35     $0 start
36     ;;
37   status)
38     status_of_proc -p $PIDFILE "$NAME" "$NAME"
39     ;;
40   *)
41     echo "Usage: /etc/init.d/goircd {start|stop|restart|status}"
42     exit 1
43 esac