aboutsummaryrefslogtreecommitdiffstats
path: root/meta-networking/recipes-netkit/netkit-rwho/netkit-rwho/rwhod
blob: f6419032e89ee309ac4663a2d0a7e83eb11c793b (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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#!/bin/sh

### BEGIN INIT INFO
# Provides:        rwhod
# Required-Start:  $network $remote_fs $syslog
# Required-Stop:   $network $remote_fs $syslog
# Default-Start:   2 3 4 5
# Default-Stop:    0 1 6
# Short-Description: Server for rwho and ruptime services
### END INIT INFO

PATH=/sbin:/bin:/usr/bin:/usr/sbin

DAEMON=/usr/sbin/rwhod
PIDFILE=/var/run/rwhod.pid
CONF_FILE="/etc/default/rwhod"
DESC="Who daemon "
# default options. Change them in /etc/default/rwhod
RWHOD_OPTIONS="-b"

# rwhod	init.d script for ntpdc from ntp.isc.org
test -f $DAEMON || exit 0

# Source function library.
. /etc/init.d/functions

[ -r $CONF_FILE ] && . $CONF_FILE

startdaemon(){
	echo -n "Starting $DESC" " rwhod "
	start-stop-daemon --start --quiet --oknodo --pidfile $PIDFILE --exec $DAEMON -- $RWHOD_OPTIONS
	echo "done"
}
stopdaemon(){
	echo -n "Stopping $DESC" " rwhod "
	start-stop-daemon --stop --quiet --oknodo --exec $DAEMON
	echo "done"
}

case "$1" in
  start)
	startdaemon
	;;
  stop)
	stopdaemon
	;;
  force-reload)
	stopdaemon
	startdaemon
	;;
  restart)
	stopdaemon
	sleep 1
	startdaemon
	;;
  reload)
	stopdaemon
	sleep 1
	startdaemon
	;;
  status)
	status /usr/sbin/rwhod;
	exit $?
	;;
  *)
	echo "Usage: rwhod { start | stop | status | restart | reload }" >&2
	exit 1
	;;
esac

exit 0