diff options
author | Roman I Khimov <khimov@altell.ru> | 2010-03-22 17:47:53 +0300 |
---|---|---|
committer | Roman I Khimov <khimov@altell.ru> | 2010-03-22 22:21:12 +0300 |
commit | 58b5bec1b6f20c569c2819db6e74a3ddd56643f2 (patch) | |
tree | d2dd60ae50373de6c99040a72a1be62d25cd2248 /recipes/conntrack-tools/files/init | |
parent | f9a7454d6930cc84b7072e83ac33627d46c2928b (diff) |
conntrack-tools: add new recipe
Includes failover script for pacemaker.
Signed-off-by: Roman I Khimov <khimov@altell.ru>
Diffstat (limited to 'recipes/conntrack-tools/files/init')
-rw-r--r-- | recipes/conntrack-tools/files/init | 77 |
1 files changed, 77 insertions, 0 deletions
diff --git a/recipes/conntrack-tools/files/init b/recipes/conntrack-tools/files/init new file mode 100644 index 0000000000..6e2f442cf0 --- /dev/null +++ b/recipes/conntrack-tools/files/init @@ -0,0 +1,77 @@ +#!/bin/sh +# +# /etc/init.d/conntrackd +# +# Maximilian Wilhelm <max@rfc2324.org> +# -- Mon, 06 Nov 2006 18:39:07 +0100 +# +# Roman I Khimov <khimov@altell.ru> +# -- Tue, 27 Oct 2009 14:34:00 +0300 + +export PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin + +NAME="conntrackd" +DAEMON="/usr/sbin/conntrackd" +CONFIG="/etc/conntrackd/conntrackd.conf" +PIDFILE="/var/run/${NAME}.pid" + + +# Gracefully exit if there is no daemon (debian way of life) +if [ ! -x "${DAEMON}" ]; then + exit 0 +fi + +# Check for config file +if [ ! -f /etc/conntrackd/conntrackd.conf ]; then + echo "Error: There is no config file for $NAME" >&2 + exit 1; +fi + +case "$1" in + start) + echo -n "Starting $NAME: " + for i in nf_conntrack_netlink nf_conntrack_netbios_ns nf_conntrack_proto_dccp nf_conntrack_tftp \ + nf_conntrack_sane nf_conntrack_pptp nf_conntrack_irc nf_conntrack_amanda nf_conntrack_h323 \ + nf_conntrack_proto_udplite nf_conntrack_proto_gre nf_conntrack_proto_sctp nf_conntrack_ftp \ + nf_conntrack_sip; do + modprobe $i >/dev/null 2>/dev/null & + done + start-stop-daemon --start --quiet --make-pidfile --pidfile "/var/run/${NAME}.pid" --background --exec "${DAEMON}" + RET=$? + if [ "$?" == "0" ]; then + sleep 2 + # Sync with other server + conntrackd -n + echo "done." + else + echo "FAILED!" + fi + exit $RET + ;; + stop) + echo -n "Stopping $NAME:" + start-stop-daemon --stop --quiet --oknodo --pidfile "/var/run/${NAME}.pid" && echo "done." || echo "FAILED!" + ;; + status) + echo -n "conntrackd " + start-stop-daemon -q -K -t -x $DAEMON + RET=$? + if [ "$RET" == "0" ]; then + PID=`cat $PIDFILE` + echo "($PID) is running" + else + echo "is not running" + exit $RET + fi + ;; + restart) + $0 start + $0 stop + ;; + + *) + echo "Usage: /etc/init.d/conntrackd {start|stop|restart}" + exit 1 +esac + +exit 0 |