#!/bin/sh # # /etc/init.d/conntrackd # # Created for RHEL/Centos by: James Shubin # ### BEGIN INIT INFO # Provides: conntrackd # Required-Start: $network $syslog # Required-Stop: $network $syslog # Should-Start: $named # Should-Stop: $named # Default-Stop: 0 1 6 # Short-Description: daemon for netfilter connection tracking # Description: This is a daemon for replicating connection state across two # machines. See http://conntrack-tools.netfilter.org/ ### END INIT INFO # the following is the chkconfig init header # # conntrackd: daemon for netfilter connection tracking # # chkconfig: - 97 03 # description: This is a daemon for replicating connection state across two # machines. See http://conntrack-tools.netfilter.org/ # # processname: conntrackd # pidfile: /var/run/conntrackd.pid # # Source function library. . /etc/rc.d/init.d/functions exec="/usr/sbin/conntrackd" prog="conntrackd" config=/etc/conntrackd/conntrackd.conf CONNTRACKD_CONFIG= CONNTRACKD_ARGS= [ -e /etc/sysconfig/$prog ] && . /etc/sysconfig/$prog lockfile=/var/lock/subsys/$prog CONNTRACKD_CONFIG_ARGS= if [ -n "$CONNTRACKD_CONFIG" ] then CONNTRACKD_CONFIG_ARGS="-C $CONNTRACKD_CONFIG" fi start() { [ -x $exec ] || exit 5 [ -f $config ] || exit 6 echo -n $"Starting $prog: " # If Linux kernel is < 2.6.22, disable TCP window tracking if uname -r | { # version cmp courtesy of geirha in #bash IFS=.- read -r a b c _; [ "$((a*10000+b*100+c))" -lt 20622 ]; }; then echo 1 > /proc/sys/net/ipv4/netfilter/ip_conntrack_tcp_be_liberal fi daemon --check $prog $prog -d $CONNTRACKD_CONFIG_ARGS $CONNTRACKD_ARGS retval=$? echo [ $retval -eq 0 ] && touch $lockfile } stop() { echo -n $"Stopping $prog: " killproc $prog retval=$? echo if [ $retval -eq 0 ]; then rm -f $lockfile rm -f /var/run/${prog}.pid fi } restart() { stop start } # XXX: can conntrackd reload? reload() { echo -n $"Reloading $prog configuration: " killproc -HUP $prog retval=$? echo return $retval } force_reload() { restart } rh_status() { # run checks to determine if the service is running or use generic status status $prog } rh_status_q() { rh_status >/dev/null 2>&1 } # See how we were called. case "$1" in start) rh_status_q && exit 0 $1 ;; stop) rh_status_q || exit 0 $1 ;; restart) $1 ;; reload) rh_status_q || exit 7 $1 ;; force-reload) force_reload ;; status) rh_status ;; condrestart|try-restart) rh_status_q || exit 0 restart ;; *) echo $"Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload}" exit 2 ;; esac exit $?