Addition of init.d script

This commit is contained in:
Mark Riddoch 2013-12-20 14:28:36 +00:00
parent d754fa9822
commit 8314773e9b

95
etc/init.d/maxscale Normal file
View File

@ -0,0 +1,95 @@
#!/bin/sh
#
# maxscale: The SkySQL MaxScale database proxy
#
# description: MaxScale provides database specific proxy functionality
#
# processname: maxscale
#
### BEGIN INIT INFO
# Provides: maxscale
# Required-Start: $syslog $local_fs
# Required-Stop: $syslog $local_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: The maxscale database proxy
# Description: MaxScale is a database proxy server that can be used to front end
# database clusters offering different routing, filtering and protocol choices
### END INIT INFO
MAXSCALE_HOME=/usr/local/skysql/maxscale
# Sanity checks.
[ -x $MAXSCALE_HOME/bin/maxscale ] || exit 0
# Source function library.
. /etc/rc.d/init.d/functions
# so we can rearrange this easily
processname=maxscale
servicename=maxscale
RETVAL=0
start() {
echo -n $"Starting MaxScale: "
if [ -x $MAXSCALE_HOME/bin/maxscale ] ; then
$MAXSCALE_HOME/bin/maxscale
fi
daemon --check $servicename $processname --system
RETVAL=$?
echo
[ $RETVAL -eq 0 ] && touch /var/lock/subsys/$servicename
}
stop() {
echo -n $"Stopping MaxScale: "
killproc $servicename -TERM
RETVAL=$?
echo
if [ $RETVAL -eq 0 ]; then
rm -f /var/lock/subsys/$servicename
fi
}
reload() {
echo -n $"Reloading MaxScale: "
killproc $servicename -HUP
RETVAL=$?
echo
}
# See how we were called.
case "$1" in
start)
start
;;
stop)
stop
;;
status)
status $servicename
RETVAL=$?
;;
restart)
stop
start
;;
condrestart)
if [ -f /var/lock/subsys/$servicename ]; then
stop
start
fi
;;
reload)
reload
RETVAL=$?
;;
*)
echo $"Usage: $0 {start|stop|status|restart|condrestart|reload}"
;;
esac
exit $RETVAL