-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwatchmysql.redhat
63 lines (59 loc) · 1.13 KB
/
watchmysql.redhat
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
#!/bin/bash
#
#
# chkconfig: 35 99 0
# description: Starts and Stops the WatchMySQL Daemon
if [ -f /etc/init.d/functions ]; then
. /etc/init.d/functions
else
echo "Count not find functions file"
exit 1
fi
if [ ! -f /usr/sbin/watchmysql ]; then
echo "/usr/sbin/watchmysql does not exist"
exit 1
fi
case "$1" in
start)
if [ `pidof -s watchmysql` ]; then
echo "watchmysql is already running"
exit 1
else
action "Starting WatchMySQL" /usr/sbin/watchmysql
fi
;;
stop)
if [ `pidof -s watchmysql` ]; then
action "Stopping WatchMySQL" kill -2 `pidof watchmysql`
else
echo "watchmysql is not running"
exit 1
fi
;;
reload)
if [ `pidof -s watchmysql` ]; then
action "Sending a reload to WatchMySQL" kill -SIGUSR1 `pidof watchmysql`
else
echo "watchmysql is not running"
exit 1
fi
;;
restart)
if [ `pidof -s watchmysql` ]; then
$0 stop
fi
sleep 1
$0 start
;;
status)
if [ `pidof -s watchmysql` ]; then
echo "watchmysql is running on pid `pidof watchmysql`"
else
echo "watchmysql is not running"
fi
;;
*)
echo "Usage: $0 {start|stop|reload|restart|status}"
exit 1
esac
exit 0