1#!/bin/sh 2# 3# (C) 2008 by Pablo Neira Ayuso <pablo@netfilter.org> 4# (C) 2009 Roman I Khimov <khimov@altell.ru> 5# 6# This software may be used and distributed according to the terms 7# of the GNU General Public License, incorporated herein by reference. 8# 9# Description: 10# 11# This is the script for primary-backup setups for keepalived 12# (http://www.keepalived.org). You may adapt it to make it work with other 13# high-availability managers. 14# 15# Do not forget to include the required modifications to your keepalived.conf 16# file to invoke this script during keepalived's state transitions. 17# 18# Contributions to improve this script are welcome :). 19# 20## Modified to work as init.d script under pacemaker control 21 22CONNTRACKD_BIN=/usr/sbin/conntrackd 23CONNTRACKD_LOCK=/var/lock/conntrack.lock 24CONNTRACKD_CONFIG=/etc/conntrackd/conntrackd.conf 25 26case "$1" in 27 start) 28 # 29 # commit the external cache into the kernel table 30 # 31 $CONNTRACKD_BIN -C $CONNTRACKD_CONFIG -c 32 if [ $? -eq 1 ] 33 then 34 logger "ERROR: failed to invoke conntrackd -c" 35 fi 36 37 # 38 # flush the internal and the external caches 39 # 40 $CONNTRACKD_BIN -C $CONNTRACKD_CONFIG -f 41 if [ $? -eq 1 ] 42 then 43 logger "ERROR: failed to invoke conntrackd -f" 44 fi 45 46 # 47 # resynchronize my internal cache to the kernel table 48 # 49 $CONNTRACKD_BIN -C $CONNTRACKD_CONFIG -R 50 if [ $? -eq 1 ] 51 then 52 logger "ERROR: failed to invoke conntrackd -R" 53 fi 54 55 # 56 # send a bulk update to backups 57 # 58 $CONNTRACKD_BIN -C $CONNTRACKD_CONFIG -B 59 if [ $? -eq 1 ] 60 then 61 logger "ERROR: failed to invoke conntrackd -B" 62 fi 63 ;; 64 stop) 65 $CONNTRACKD_BIN -t 66 $CONNTRACKD_BIN -n 67 ;; 68 status) 69 ;; 70 *) 71 logger "ERROR: unknown command" 72 echo "Usage: conntrack-failover {start|stop|status}" 73 exit 1 74 ;; 75esac 76 77exit 0 78