From 8314773e9bfc823456ff6c189cc8363efae3d8d2 Mon Sep 17 00:00:00 2001 From: Mark Riddoch Date: Fri, 20 Dec 2013 14:28:36 +0000 Subject: [PATCH] Addition of init.d script --- etc/init.d/maxscale | 95 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 95 insertions(+) create mode 100644 etc/init.d/maxscale diff --git a/etc/init.d/maxscale b/etc/init.d/maxscale new file mode 100644 index 000000000..a760a5ec8 --- /dev/null +++ b/etc/init.d/maxscale @@ -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