Sophie

Sophie

distrib > Mageia > 5 > i586 > media > core-release-src > by-pkgid > ed7fa7c0859552ed86bc18a6e6ef8bdd > files > 2

maxscale-0.7.0-4.mga5.src.rpm

#!/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

# Source function library.
. /etc/rc.d/init.d/functions

# Sanity checks.
[ -x /usr/sbin/maxscale ] || exit 0

MAXSCALE_HOME=/var/lib/maxscale
if [ -f /etc/sysconfig/maxscale ]; then
        . /etc/sysconfig/maxscale
fi

prog=maxscale

RETVAL=0

start() {
    echo -n $"Starting MaxScale: "
    daemon --user=$prog $prog $MAXSCALE_OPTIONS 2>/dev/null
    RETVAL=$?
    echo
    [ $RETVAL -eq 0 ] && touch /var/lock/subsys/$prog
}

stop() {
    echo -n $"Stopping MaxScale: "
    killproc $prog -TERM
    RETVAL=$?
    echo
    if [ $RETVAL -eq 0 ]; then
        rm -f /var/lock/subsys/$prog
    fi
}

reload() {
    echo -n $"Reloading MaxScale: "
    killproc $prog -HUP
    RETVAL=$?
    echo
}

# See how we were called.
case "$1" in
    start)
        start
        ;;
    stop)
        stop
        ;;
    status)
        status $prog
        RETVAL=$?
        ;;
    restart)
        stop
        start
        ;;
    condrestart)
        if [ -f /var/lock/subsys/$prog ]; then
            stop
            start
        fi
        ;;
    reload)
	reload
        RETVAL=$?
        ;;
    *)
        echo $"Usage: $0 {start|stop|status|restart|condrestart|reload}"
        ;;
esac
exit $RETVAL