aboutsummaryrefslogtreecommitdiff
path: root/network/elemental-ircd/rc.elemental-ircd
blob: 7f3dd4f247d506958695856e6cf73c7c0c271231 (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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#!/bin/sh
#
# elemental-ircd startup script for Slackware

IRCD_USER="@IRCD_UNAME@"

# Don't edit PIDFILE ; it's set in configure by --with-rundir
PIDFILE=/var/run/elemental-ircd/ircd.pid
PID=$(cat $PIDFILE 2>/dev/null)

ircd_start() {
  echo "Starting elemental-ircd."
  mkdir -p $(dirname $PIDFILE)
  chown $IRCD_USER:$IRCD_GROUP $(dirname $PIDFILE)
  setpriv --reset-env --reuid $IRCD_USER /usr/bin/ircd
}

ircd_stop() {
  echo -n "Stopping elemental-ircd..."
  kill -TERM $PID 2>/dev/null
  echo " done."
}

ircd_reload() {
	echo -n "Sending signal to elemental-ircd to reload its configuration..."
	if kill -CHLD $PID 2>/dev/null; then
		kill -HUP $PID
		echo " done."
	else
		echo "elemental-ircd doesn't seem to be running."
		exit 1
	fi
}

ircd_restart() {
  ircd_stop
  sleep 1
  ircd_start
}

case "$1" in
  start)
    ircd_start
    ;;
  stop)
    ircd_stop
    ;;
  restart)
    ircd_restart
    ;;
  reload)
	ircd_reload
	;;
  *)
    echo "Usage: $0 {start|stop|restart|reload}"
    exit 1
esac