packages: haproxy/haproxy.init - unify and fix LSB, add try-restart
glen
glen at pld-linux.org
Tue May 26 10:18:40 CEST 2009
Author: glen Date: Tue May 26 08:18:40 2009 GMT
Module: packages Tag: HEAD
---- Log message:
- unify and fix LSB, add try-restart
---- Files affected:
packages/haproxy:
haproxy.init (1.4 -> 1.5)
---- Diffs:
================================================================
Index: packages/haproxy/haproxy.init
diff -u packages/haproxy/haproxy.init:1.4 packages/haproxy/haproxy.init:1.5
--- packages/haproxy/haproxy.init:1.4 Fri May 1 03:09:00 2009
+++ packages/haproxy/haproxy.init Tue May 26 10:18:34 2009
@@ -23,7 +23,7 @@
# Check that networking is up.
if is_yes "${NETWORKING}"; then
if [ ! -f /var/lock/subsys/network -a "$1" != stop -a "$1" != status ]; then
- msg_network_down haproxy
+ msg_network_down "HA-Proxy"
exit 1
fi
else
@@ -35,24 +35,51 @@
}
start() {
- if [ ! -f /var/lock/subsys/haproxy ]; then
- msg_starting haproxy
- daemon /usr/sbin/haproxy -D -f /etc/haproxy/haproxy.cfg -p /var/run/haproxy.pid
- RETVAL=$?
- [ $RETVAL -eq 0 ] && touch /var/lock/subsys/haproxy
- else
- msg_already_running haproxy
+ if [ -f /var/lock/subsys/haproxy ]; then
+ msg_already_running "HA-Proxy"
+ return
fi
+
+ msg_starting "HA-Proxy"
+ daemon /usr/sbin/haproxy -D -f /etc/haproxy/haproxy.cfg -p /var/run/haproxy.pid
+ RETVAL=$?
+ [ $RETVAL -eq 0 ] && touch /var/lock/subsys/haproxy
}
stop() {
- if [ -f /var/lock/subsys/haproxy ]; then
- msg_stopping haproxy
- killproc --pidfile /var/run/haproxy.pid haproxy
- rm -f /var/lock/subsys/haproxy
- else
- msg_not_running haproxy
+ if [ ! -f /var/lock/subsys/haproxy ]; then
+ msg_not_running "HA-Proxy"
+ return
+ fi
+
+ msg_stopping "HA-Proxy"
+ killproc --pidfile /var/run/haproxy.pid haproxy
+ rm -f /var/lock/subsys/haproxy
+}
+
+reload() {
+ if [ ! -f /var/lock/subsys/haproxy ]; then
+ msg_not_running "HA-Proxy"
+ RETVAL=7
+ return
+ fi
+
+ # TODO: check if pid is valid and start instead
+ checkconfig
+ msg_reloading "HA-Proxy"
+ daemon /usr/sbin/haproxy -f /etc/haproxy/haproxy.cfg -p /var/run/haproxy.pid -st $(</var/run/haproxy.pid)
+ RETVAL=$?
+}
+
+condrestart() {
+ if [ ! -f /var/lock/subsys/haproxy ]; then
+ msg_not_running "HA-Proxy"
+ RETVAL=$1
+ return
fi
+
+ stop
+ start
}
RETVAL=0
@@ -64,28 +91,23 @@
stop)
stop
;;
- restart|force-reload)
+ restart)
checkconfig
stop
start
;;
- reload)
- if [ -f /var/lock/subsys/haproxy ]; then
- checkconfig
- msg_reloading haproxy
- daemon /usr/sbin/haproxy -f /etc/haproxy/haproxy.cfg -p /var/run/haproxy.pid -st $(</var/run/haproxy.pid)
- RETVAL=$?
- else
- msg_not_running haproxy
- exit 7
- fi
+ try-restart)
+ condrestart 0
+ ;;
+ reload|force-reload)
+ reload
;;
status)
status haproxy
exit $?
;;
*)
- msg_usage "$0 {start|stop|restart|reload|force-reload|status}"
+ msg_usage "$0 {start|stop|restart|reload|try-restart|force-reload|status}"
exit 3
esac
================================================================
---- CVS-web:
http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/packages/haproxy/haproxy.init?r1=1.4&r2=1.5&f=u
More information about the pld-cvs-commit
mailing list