summaryrefslogtreecommitdiff
path: root/startup/debian.sh
blob: cc31d24b5d3c1e06ec0aac8bc061409ce83b1291 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#! /bin/sh

### BEGIN INIT INFO
# Provides:          goircd
# Required-Start:    $remote_fs $network
# Required-Stop:     $remote_fs $network
# Default-Start:     2 3 4 5
# Default-Stop:
# Short-Description: goircd IRC server
# Description:       goircd IRC server
### END INIT INFO

NAME=goircd
DAEMON=/home/goircd/goircd
PIDFILE=/var/run/goircd.pid

. /lib/lsb/init-functions

case "$1" in
  start)
    log_daemon_msg "Starting $NAME daemon" "$NAME"
    start-stop-daemon --start --quiet --background \
      --pidfile $PIDFILE --make-pidfile --exec $DAEMON \
      -- -hostname irc.example.com
    log_end_msg $?
    ;;
  stop)
    log_daemon_msg "Stopping $NAME daemon" "$NAME"
    start-stop-daemon --stop --quiet --oknodo --pidfile $PIDFILE
    log_end_msg $?
    rm -f $PIDFILE
    ;;
  restart)
    $0 stop || :
    $0 start
    ;;
  status)
    status_of_proc -p $PIDFILE "$NAME" "$NAME"
    ;;
  *)
    echo "Usage: /etc/init.d/goircd {start|stop|restart|status}"
    exit 1
esac