blob: f6419032e89ee309ac4663a2d0a7e83eb11c793b [file] [log] [blame]
Patrick Williamsb48b7b42016-08-17 15:04:38 -05001#!/bin/sh
2
3### BEGIN INIT INFO
4# Provides: rwhod
5# Required-Start: $network $remote_fs $syslog
6# Required-Stop: $network $remote_fs $syslog
7# Default-Start: 2 3 4 5
8# Default-Stop: 0 1 6
9# Short-Description: Server for rwho and ruptime services
10### END INIT INFO
11
12PATH=/sbin:/bin:/usr/bin:/usr/sbin
13
14DAEMON=/usr/sbin/rwhod
15PIDFILE=/var/run/rwhod.pid
16CONF_FILE="/etc/default/rwhod"
17DESC="Who daemon "
18# default options. Change them in /etc/default/rwhod
19RWHOD_OPTIONS="-b"
20
21# rwhod init.d script for ntpdc from ntp.isc.org
22test -f $DAEMON || exit 0
23
24# Source function library.
25. /etc/init.d/functions
26
27[ -r $CONF_FILE ] && . $CONF_FILE
28
29startdaemon(){
30 echo -n "Starting $DESC" " rwhod "
31 start-stop-daemon --start --quiet --oknodo --pidfile $PIDFILE --exec $DAEMON -- $RWHOD_OPTIONS
32 echo "done"
33}
34stopdaemon(){
35 echo -n "Stopping $DESC" " rwhod "
36 start-stop-daemon --stop --quiet --oknodo --exec $DAEMON
37 echo "done"
38}
39
40case "$1" in
41 start)
42 startdaemon
43 ;;
44 stop)
45 stopdaemon
46 ;;
47 force-reload)
48 stopdaemon
49 startdaemon
50 ;;
51 restart)
52 stopdaemon
53 sleep 1
54 startdaemon
55 ;;
56 reload)
57 stopdaemon
58 sleep 1
59 startdaemon
60 ;;
61 status)
62 status /usr/sbin/rwhod;
63 exit $?
64 ;;
65 *)
66 echo "Usage: rwhod { start | stop | status | restart | reload }" >&2
67 exit 1
68 ;;
69esac
70
71exit 0