-
Notifications
You must be signed in to change notification settings - Fork 0
/
watch-switch-config
executable file
·68 lines (61 loc) · 1.24 KB
/
watch-switch-config
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
#!/bin/sh
#
# watch-switch-config: This starts and stops watch-switch-config.pl
#
# chkconfig: 3 12 88
# description: watch-switch-config.pl watches rsyslog for cisco cofiguration changes
# processname: watch-switch-config.pl
# pidfile: /var/run/watch-switch-config.pl.pid
### BEGIN INIT INFO
# Provides: watch-switch-config.pl
### END INIT INFO
# Source function library.
. /etc/rc.d/init.d/functions
CONFIGWATCH=/usr/local/scripts/watch-switch-config.pl
LOCKF=/var/lock/subsys/watch-switch-config
PIDF=/var/run/watch-switch-config.pl.pid
[ -f $CONFIGWATCH ] || exit 0
RETVAL=0
case "$1" in
start)
echo -n $"Starting watch-switch-config: "
daemon $CONFIGWATCH
RETVAL=$?
PID=$!
echo
[ $RETVAL -eq 0 ] && touch $LOCKF
echo $PID > $PIDF
;;
stop)
echo -n $"Stopping watch-switch-config: "
killproc $CONFIGWATCH
RETVAL=$?
echo
if [ $RETVAL -eq 0 ]; then
rm -f $LOCKF
rm -f $PIDF
fi
;;
status)
status $CONFIGWATCH
RETVAL=$?
;;
restart)
$0 stop
sleep 3
$0 start
RETVAL=$?
;;
condrestart)
if [ -f $LOCKF ]; then
$0 stop
sleep 3
$0 start
RETVAL=$?
fi
;;
*)
echo $"Usage: $0 {start|stop|status|reload|condrestart}"
exit 1
esac
exit $RETVAL