3 # pt-kill This shell script takes care of starting and stopping the pt-kill services.
7 # description: pt-kill stops long running MySQL queries
10 # Source function library
11 . /etc/rc.d/init.d/functions
14 . /etc/sysconfig/network
16 # Check that networking is up.
17 if is_yes "${NETWORKING}"; then
18 if [ ! -f /var/lock/subsys/network -a "$1" != stop -a "$1" != status ]; then
19 msg_network_down "pt-kill"
26 config=/etc/percona-toolkit/pt-kill.conf
27 sentinel=/var/run/pt-kill/pt-kill.sentinel
28 pidfile=/var/run/pt-kill/pt-kill.pid
31 # Get service config - may override defaults
32 [ -f /etc/sysconfig/pt-kill ] && . /etc/sysconfig/pt-kill
35 # Check if the service is already running?
36 if [ -f /var/lock/subsys/pt-kill ]; then
37 msg_already_running "pt-kill"
41 msg_starting "pt-kill"
42 # FIXME: instead of removing, fix stop process
44 daemon --user $user --redirfds /usr/bin/pt-kill --config $config --daemonize --pid $pidfile --sentinel $sentinel
46 [ $RETVAL -eq 0 ] && touch /var/lock/subsys/pt-kill
50 if [ ! -f /var/lock/subsys/pt-kill ]; then
51 msg_not_running "pt-kill"
56 msg_stopping "pt-kill"
57 run_cmd --user $user "pt-kill" /usr/bin/pt-kill --config $config --stop --sentinel $sentinel
58 # FIXME: wait for sentinel and remove it
59 rm -f /var/lock/subsys/pt-kill
63 if [ ! -f /var/lock/subsys/pt-kill ]; then
64 msg_not_running "pt-kill"
74 # See how we were called.
93 status --pidfile $pidfile pt-kill
97 msg_usage "$0 {start|stop|restart|try-restart|force-reload|status}"