blob: cc81dc3bc7a9f5976323ebd3b08f93eed9861840 (
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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
|
#!/bin/sh
#
# /etc/init.d/foolsm
#
# This shellscript takes care of starting and stopping foolsm.
#
# chkconfig: - 79 31
# description: Foolsm, Link Status Monitor
#
### BEGIN INIT INFO
# Provides: foolsm
# Required-Start: $network $syslog
# Required-Stop:
# Default-Start:
# Default-Stop: 0 1 6
# Short-Description: Foolsm - link status monitor
# Description: Foolsm is the link status monitor
# Foolsm can ping multiple targets and when up or down event happens
# it will execute user configured external script so it can be used
# as poor man's routing protocol.
### END INIT INFO
# Source function library.
. /etc/init.d/functions
# Source networking configuration.
. /etc/sysconfig/network
# Check that networking is up.
[ ${NETWORKING} = "no" ] && exit 0
CONFIGFILE="/etc/foolsm/foolsm.conf"
PIDFILE="/var/run/foolsm.pid"
[ -f /etc/sysconfig/foolsm ] && . /etc/sysconfig/foolsm
[ -x /usr/sbin/foolsm ] || exit 0
RETVAL=0
start() {
echo -n $"Starting foolsm: "
daemon --pidfile=${PIDFILE} /usr/sbin/foolsm --config $CONFIGFILE --pidfile $PIDFILE
RETVAL=$?
/bin/usleep 10000
echo
[ $RETVAL = 0 ] && touch /var/lock/subsys/foolsm
return $RETVAL
}
stop() {
echo -n $"Stopping foolsm: "
killproc /usr/sbin/foolsm
RETVAL=$?
echo
[ $RETVAL = 0 ] && rm -f /var/lock/subsys/foolsm
return $RETVAL
}
restart() {
stop
start
}
reload() {
echo -n $"Reloading foolsm: "
killproc -p ${PIDFILE} /usr/sbin/foolsm -HUP
RETVAL=$?
echo
return $RETVAL
}
# See how we were called.
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
restart
;;
reload)
reload
;;
condrestart)
[ -f /var/lock/subsys/foolsm ] && restart
;;
status)
status -p ${PIDFILE} foolsm
RETVAL=$?
;;
*)
echo "Usage: foolsm {start|stop|restart|condrestart|status}"
RETVAL=2
esac
exit $RETVAL
|