112 lines
2.2 KiB
Bash
112 lines
2.2 KiB
Bash
#!/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
|
|
|
|
export MAXSCALE_BASEDIR=/servers/maxscale-1.1.0
|
|
export MAXSCALE_BIN=$MAXSCALE_BASEDIR/bin
|
|
export MAXSCALE_HOME=$MAXSCALE_BASEDIR/MaxScale
|
|
export MAXSCALE_PIDFILE=$MAXSCALE_HOME/log/maxscale.pid
|
|
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:XSCALE_HOME=/servers/maxscale-1.1.0/MaxScale
|
|
|
|
# Sanity checks.
|
|
[ -x $MAXSCALE_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_BIN/maxscale ] ; then
|
|
$MAXSCALE_BIN/maxscale >& /dev/null
|
|
fi
|
|
|
|
daemon --pidfile $MAXSCALE_PIDFILE
|
|
|
|
RETVAL=$?
|
|
[ $RETVAL -eq 0 ] && touch /var/lock/subsys/$servicename
|
|
|
|
echo
|
|
|
|
if [ $RETVAL -ne 0 ]; then
|
|
return 7;
|
|
fi
|
|
}
|
|
|
|
stop() {
|
|
echo -n $"Stopping MaxScale: "
|
|
|
|
killproc -p $MAXSCALE_PIDFILE
|
|
RETVAL=$?
|
|
|
|
echo
|
|
|
|
if [ $RETVAL -eq 0 ]; then
|
|
rm -f /var/lock/subsys/$servicename
|
|
else
|
|
return 7;
|
|
fi
|
|
}
|
|
|
|
reload() {
|
|
echo -n $"Reloading MaxScale: "
|
|
|
|
killproc $servicename -HUP
|
|
RETVAL=$?
|
|
echo
|
|
}
|
|
|
|
# See how we were called.
|
|
case "$1" in
|
|
start)
|
|
start
|
|
;;
|
|
stop)
|
|
stop
|
|
;;
|
|
status)
|
|
echo -n $"Checking MaxScale status: "
|
|
status -p $MAXSCALE_PIDFILE 'MaxScale'
|
|
RETVAL=$?
|
|
[ $RETVAL -ne 0 ] && return 3
|
|
;;
|
|
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
|