First implementation LSB compatibility

First implementation LSB compatibility
This commit is contained in:
MassimilianoPinto 2014-06-28 23:05:45 +02:00
parent 4f47f09207
commit fc68996701

View File

@ -21,10 +21,10 @@ 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
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$MAXSCALE_BASEDIR/lib
# Sanity checks.
[ -x $MAXSCALE_BIN/maxscale ] || exit 0
[ -x $MAXSCALE_BIN/maxscale ] || exit 7
# Source function library.
. /etc/rc.d/init.d/functions
@ -36,12 +36,16 @@ servicename=maxscale
RETVAL=0
start() {
echo `date` "Try to start" >> /tmp/maxscale.log
echo -n $"Starting MaxScale: "
if [ -x $MAXSCALE_BIN/maxscale ] ; then
$MAXSCALE_BIN/maxscale >& /dev/null
fi
daemon --pidfile $MAXSCALE_PIDFILE
#if [ -x $MAXSCALE_BIN/maxscale ] ; then
# $MAXSCALE_BIN/maxscale >& /dev/null
#fi
daemon --pidfile $MAXSCALE_PIDFILE $MAXSCALE_BIN/maxscale >& /dev/null
echo `date` "Started" >> /tmp/maxscale.log
RETVAL=$?
[ $RETVAL -eq 0 ] && touch /var/lock/subsys/$servicename
@ -49,11 +53,25 @@ start() {
echo
if [ $RETVAL -ne 0 ]; then
return 7;
return 0;
fi
return 0
}
startcheck() {
status -p $MAXSCALE_PIDFILE 'MaxScale'
RETVAL=$?
#if running status is 0, so return 1 here to the caller
if [ $RETVAL -eq 0 ]; then
# echo " return 1 forced, running"
return 1
fi
#echo " return 1 for not running"
return 0
}
stop() {
echo `date` "Try to stop" >> /tmp/maxscale.log
echo -n $"Stopping MaxScale: "
killproc -p $MAXSCALE_PIDFILE
@ -63,8 +81,11 @@ stop() {
if [ $RETVAL -eq 0 ]; then
rm -f /var/lock/subsys/$servicename
echo `date` "Stopped with subsys removed " >> /tmp/maxscale.log
return 0
else
return 7;
echo `date` "Stopped without subsys removed " >> /tmp/maxscale.log
return 0;
fi
}
@ -79,7 +100,17 @@ reload() {
# See how we were called.
case "$1" in
start)
start
#echo `date` "Check before start " >> /tmp/maxscale.log
#startcheck -p $MAXSCALE_PIDFILE 'MaxScale'
#RETVAL=$?
#echo -n "retval of startcheck is "
#echo $RETVAL
#if [ $RETVAL -eq 1 ]; then
# echo "MaxScale is running, $RETVAL"
# echo `date` "MaxScale runs, start skipped " >> /tmp/maxscale.log
# exit 0
#fi
start
;;
stop)
stop
@ -88,7 +119,14 @@ case "$1" in
echo -n $"Checking MaxScale status: "
status -p $MAXSCALE_PIDFILE 'MaxScale'
RETVAL=$?
[ $RETVAL -ne 0 ] && return 3
echo `date` ">>MaxScale true status is $RETVAL, !=0 -> 3, pidfile $MAXSCALE_PIDFILE" >> /tmp/maxscale.log
if [ $RETVAL -eq 1 ]; then
exit 3
fi
if [ $RETVAL -ne 0 ]; then
exit 3
fi
exit $RETVAL
;;
restart)
stop