2018-01-15 15:17:04 +00:00
|
|
|
Index: keepalived-1.4.0/keepalived/etc/init.d/keepalived.suse.init.in
|
2013-11-19 15:12:38 +00:00
|
|
|
===================================================================
|
2018-01-15 15:17:04 +00:00
|
|
|
--- keepalived-1.4.0.orig/keepalived/etc/init.d/keepalived.suse.init.in
|
|
|
|
+++ keepalived-1.4.0/keepalived/etc/init.d/keepalived.suse.init.in
|
2017-11-27 10:49:50 +00:00
|
|
|
@@ -1,23 +1,23 @@
|
2016-03-09 17:20:53 +00:00
|
|
|
#! /bin/sh
|
2018-01-15 15:17:04 +00:00
|
|
|
|
2013-11-19 15:12:38 +00:00
|
|
|
### BEGIN INIT INFO
|
2016-03-09 17:20:53 +00:00
|
|
|
-# Provides: keepalived
|
2017-11-27 10:49:50 +00:00
|
|
|
+# Provides: keepalived
|
2013-11-19 15:12:38 +00:00
|
|
|
# Required-Start: $remote_fs $syslog
|
|
|
|
-# Required-Stop : $remote_fs $syslog
|
|
|
|
-# Default-Start : 3 5
|
|
|
|
-# Default-Stop : 0 1 2 6
|
|
|
|
-# Description : Start keepalived to allow XY and provide YZ
|
|
|
|
-# continued on second line by '#<TAB>'
|
|
|
|
+# Required-Stop: $remote_fs $syslog
|
|
|
|
+# Default-Start: 3 5
|
|
|
|
+# Default-Stop: 0 1 2 6
|
2017-11-27 10:49:50 +00:00
|
|
|
+# Short-Description: Start keepalived to manage IPVS & LVS
|
|
|
|
+# Description: Start keepalived to manage IPVS & LVS
|
2013-11-19 15:12:38 +00:00
|
|
|
### END INIT INFO
|
2018-01-15 15:17:04 +00:00
|
|
|
|
|
|
|
|
2016-03-09 17:20:53 +00:00
|
|
|
-DAEMON="Keepalived daemon"
|
2017-11-27 10:49:50 +00:00
|
|
|
-DAEMON_BIN="@sbindir@/keepalived"
|
|
|
|
-DAEMON_CONF="@sysconfdir@/keepalived/keepalived.conf"
|
|
|
|
-DAEMON_PIDFILE="@localstatedir@/run/keepalived.pid"
|
2016-03-09 17:20:53 +00:00
|
|
|
-DAEMON_OPT="-d"
|
|
|
|
+DAEMON='Keepalived daemon'
|
2017-11-27 10:49:50 +00:00
|
|
|
+DAEMON_BIN='@sbindir@/keepalived'
|
|
|
|
+DAEMON_CONF='@sysconfdir@/keepalived/keepalived.conf'
|
|
|
|
+DAEMON_PIDFILE='@localstatedir@/run/keepalived.pid'
|
|
|
|
+DAEMON_OPT='-d'
|
2016-03-09 17:20:53 +00:00
|
|
|
#DAEMON_USER="root"
|
2017-11-27 10:49:50 +00:00
|
|
|
-SUPPORTS_HUP="yes"
|
2016-03-09 17:20:53 +00:00
|
|
|
+SUPPORTS_HUP='yes'
|
2017-11-27 10:49:50 +00:00
|
|
|
# PidFile @localstatedir@/run/keepalived.pid
|
2016-03-09 17:20:53 +00:00
|
|
|
# DatabaseOwner root
|
2018-01-15 15:17:04 +00:00
|
|
|
|
|
|
|
@@ -25,6 +25,18 @@ pid_par=${DAEMON_PIDFILE:+"-p $DAEMON_PI
|
2016-03-09 17:20:53 +00:00
|
|
|
usr_par=${DAEMON_USER:+"-u $DAEMON_USER"}
|
2018-01-15 15:17:04 +00:00
|
|
|
|
2017-11-27 10:49:50 +00:00
|
|
|
test -x $DAEMON_BIN || exit 5
|
2016-03-09 17:20:53 +00:00
|
|
|
+test -x $DAEMON_BIN || { echo "$DAEMON_BIN not installed or executable";
|
|
|
|
+ if [ "$1" = "stop" ]; then exit 0;
|
|
|
|
+ else exit 5; fi; }
|
|
|
|
+
|
|
|
|
+test -r $DAEMON_CONF || { echo "$DAEMON_CONF not existing or readable";
|
|
|
|
+ if [ "$1" = "stop" ]; then exit 0;
|
|
|
|
+ else exit 6; fi; }
|
|
|
|
+
|
|
|
|
+# read sysconfig variables that might overwrite the daemon options
|
|
|
|
+if [ -r "$DAEMON_SYSCONF" ]; then
|
|
|
|
+ . "$DAEMON_SYSCONF"
|
|
|
|
+fi
|
2018-01-15 15:17:04 +00:00
|
|
|
|
2016-03-09 17:20:53 +00:00
|
|
|
# Shell functions sourced from /etc/rc.status:
|
|
|
|
# rc_check check and set local and overall rc status
|
2017-11-27 10:49:50 +00:00
|
|
|
@@ -60,71 +72,70 @@ rc_reset
|
|
|
|
test -e $DAEMON_PIDFILE && ! test -s $DAEMON_PIDFILE && rm $DAEMON_PIDFILE
|
2018-01-15 15:17:04 +00:00
|
|
|
|
2016-03-09 17:20:53 +00:00
|
|
|
case "$1" in
|
2017-11-27 10:49:50 +00:00
|
|
|
- start)
|
2016-03-09 17:20:53 +00:00
|
|
|
- echo -n "Starting $DAEMON "
|
|
|
|
- if test ! -f ${DAEMON_CONF}; then
|
|
|
|
- echo -n >&2 "Configuration file, ${DAEMON_CONF} does not exist. "
|
|
|
|
- rc_status -s
|
|
|
|
- exit 6
|
|
|
|
- fi
|
|
|
|
- checkproc $pid_par ${DAEMON_BIN}
|
|
|
|
- case $? in
|
|
|
|
- 0) echo -n "- Warning: daemon already running. " ;;
|
|
|
|
- 1) echo -n "- Warning: ${DAEMON_PIDFILE} exists. " ;;
|
|
|
|
- esac
|
|
|
|
-# echo "startproc $usr_par $pid_par ${DAEMON_BIN} ${DAEMON_OPT}"
|
|
|
|
- startproc $usr_par $pid_par ${DAEMON_BIN} ${DAEMON_OPT}
|
|
|
|
- rc_status -v
|
|
|
|
- ;;
|
|
|
|
- stop)
|
|
|
|
- echo -n "Shutting down $DAEMON "
|
|
|
|
- checkproc $pid_par ${DAEMON_BIN} || \
|
|
|
|
- echo -n " Warning: daemon not running. "
|
|
|
|
- killproc $pid_par -t 10 ${DAEMON_BIN}
|
|
|
|
- rc_status -v
|
|
|
|
- ;;
|
|
|
|
- try-restart|condrestart)
|
|
|
|
- if test "$1" = "condrestart"; then
|
|
|
|
- echo "${attn} Use try-restart ${done}(LSB)${attn} rather than condrestart ${warn}(RH)${norm}"
|
|
|
|
- fi
|
|
|
|
- $0 status
|
|
|
|
- if test $? = 0; then
|
|
|
|
- $0 restart
|
2017-11-27 10:49:50 +00:00
|
|
|
- else
|
2016-03-09 17:20:53 +00:00
|
|
|
- rc_reset
|
|
|
|
- fi
|
|
|
|
- rc_status
|
|
|
|
- ;;
|
|
|
|
- restart)
|
|
|
|
- $0 stop
|
|
|
|
- $0 start
|
|
|
|
- rc_status
|
|
|
|
- ;;
|
|
|
|
- force-reload|reload)
|
|
|
|
- if test "$SUPPORTS_HUP" = "yes"; then
|
|
|
|
- echo -n "Reload service $DAEMON "
|
|
|
|
- checkproc $pid_par ${DAEMON_BIN} && \
|
|
|
|
- touch ${DAEMON_PIDFILE} || \
|
|
|
|
- echo -n >&2 " Warning: daemon not running. "
|
|
|
|
- killproc $pid_par -HUP ${DAEMON_BIN}
|
2017-11-27 10:49:50 +00:00
|
|
|
- rc_status -v
|
2016-03-09 17:20:53 +00:00
|
|
|
- else
|
2017-11-27 10:49:50 +00:00
|
|
|
- $0 stop && sleep 3 && $0 start
|
|
|
|
- rc_status
|
2016-03-09 17:20:53 +00:00
|
|
|
- fi
|
|
|
|
- ;;
|
|
|
|
- status)
|
|
|
|
- echo -n "Checking for $DAEMON "
|
|
|
|
- checkproc $pid_par ${DAEMON_BIN}
|
|
|
|
- rc_status -v
|
|
|
|
- ;;
|
|
|
|
- probe)
|
|
|
|
- test ${DAEMON_CONF} -nt ${DAEMON_PIDFILE} && echo reload
|
|
|
|
- ;;
|
|
|
|
- *)
|
|
|
|
- echo "Usage: $0 {start|stop|status|try-restart|restart|force-reload|reload|probe}"
|
|
|
|
- exit 1
|
|
|
|
- ;;
|
2017-11-27 10:49:50 +00:00
|
|
|
+ start)
|
|
|
|
+ echo -n "Starting $DAEMON "
|
|
|
|
+ if test ! -f ${DAEMON_CONF}; then
|
|
|
|
+ echo -n >&2 "Configuration file, ${DAEMON_CONF} does not exist. "
|
|
|
|
+ rc_status -s
|
|
|
|
+ exit 6
|
|
|
|
+ fi
|
|
|
|
+ checkproc $pid_par ${DAEMON_BIN}
|
|
|
|
+ case $? in
|
|
|
|
+ 0) echo -n "- Warning: daemon already running. " ;;
|
|
|
|
+ 1) echo -n "- Warning: ${DAEMON_PIDFILE} exists. " ;;
|
|
|
|
+ esac
|
|
|
|
+# echo "startproc $usr_par $pid_par ${DAEMON_BIN} ${KEEPALIVED_OPTIONS}"
|
|
|
|
+ startproc $usr_par $pid_par ${DAEMON_BIN} ${KEEPALIVED_OPTIONS}
|
|
|
|
+ rc_status -v
|
|
|
|
+ ;;
|
|
|
|
+ stop)
|
|
|
|
+ echo -n "Shutting down $DAEMON "
|
|
|
|
+ checkproc $pid_par ${DAEMON_BIN} || \
|
|
|
|
+ echo -n " Warning: daemon not running. "
|
|
|
|
+ killproc $pid_par -t 10 ${DAEMON_BIN}
|
|
|
|
+ rc_status -v
|
|
|
|
+ ;;
|
|
|
|
+ try-restart|condrestart)
|
|
|
|
+ if test "$1" = "condrestart"; then
|
|
|
|
+ echo "${attn} Use try-restart ${done}(LSB)${attn} rather than condrestart ${warn}(RH)${norm}"
|
|
|
|
+ fi
|
|
|
|
+ $0 status
|
|
|
|
+ if test $? = 0; then
|
|
|
|
+ $0 restart
|
|
|
|
+ else
|
|
|
|
+ rc_reset
|
|
|
|
+ fi
|
|
|
|
+ rc_status
|
|
|
|
+ ;;
|
|
|
|
+ restart)
|
|
|
|
+ $0 stop
|
|
|
|
+ $0 start
|
|
|
|
+ rc_status
|
|
|
|
+ ;;
|
|
|
|
+ force-reload|reload)
|
|
|
|
+ if test "$SUPPORTS_HUP" = "yes"; then
|
|
|
|
+ echo -n "Reload service $DAEMON "
|
|
|
|
+ checkproc $pid_par ${DAEMON_BIN} && \
|
|
|
|
+ touch ${DAEMON_PIDFILE} || \
|
|
|
|
+ echo -n >&2 " Warning: daemon not running. "
|
|
|
|
+ killproc $pid_par -HUP ${DAEMON_BIN}
|
2016-03-09 17:20:53 +00:00
|
|
|
+ rc_status -v
|
2017-11-27 10:49:50 +00:00
|
|
|
+ else
|
|
|
|
+ $0 stop && sleep 3 && $0 start
|
|
|
|
+ rc_status
|
|
|
|
+ fi
|
|
|
|
+ ;;
|
|
|
|
+ status)
|
|
|
|
+ echo -n "Checking for $DAEMON "
|
|
|
|
+ checkproc $pid_par ${DAEMON_BIN}
|
|
|
|
+ rc_status -v
|
|
|
|
+ ;;
|
|
|
|
+ probe)
|
|
|
|
+ test ${DAEMON_CONF} -nt ${DAEMON_PIDFILE} && echo reload
|
|
|
|
+ ;;
|
|
|
|
+ *)
|
|
|
|
+ echo "Usage: $0 {start|stop|status|try-restart|restart|force-reload|reload|probe}"
|
|
|
|
+ exit 1
|
|
|
|
+ ;;
|
2016-03-09 17:20:53 +00:00
|
|
|
esac
|
|
|
|
rc_exit
|
2017-11-27 10:49:50 +00:00
|
|
|
-
|