/etc/init.d/ipvsadm is in ipvsadm 1:1.26-2ubuntu1.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 | #!/bin/sh
# ipvsadm Manageѕ ipvsadm daemon
#
### BEGIN INIT INFO
# Provides: ipvsadm
# Required-Start: $network
# Required-Stop: $network
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Description: Starts ipvsadm daemon
# short-description: ipvsadm daemon
### END INIT INFO
#includes lsb functions
. /lib/lsb/init-functions
IPVSADM="/sbin/ipvsadm"
IPVSADM_RULES="/etc/ipvsadm.rules"
IPVSADM_CONFIG="/etc/default/ipvsadm"
SYNCID="1"
AUTO="false"
DAEMON="none" # none|master|backup|both
IFACE="eth0"
FAILURE=0
start () {
case $DAEMON in
master|backup)
log_daemon_msg "Starting IPVS Connection Synchronization Daemon" "$DAEMON"
$IPVSADM --start-daemon $DAEMON --mcast-interface $IFACE || log_end_msg 1
log_end_msg 0
;;
both)
log_daemon_msg "Starting IPVS Connection Synchronization Daemon" "master"
$IPVSADM --start-daemon master --mcast-interface $IFACE || FAILURE=1
log_progress_msg "backup"
$IPVSADM --start-daemon backup --mcast-interface $IFACE || FAILURE=1
if [ "$FAILURE" -eq 1 ]
then
log_end_msg 1
else
log_end_msg 0
fi
;;
*)
log_action_msg "ipvsadm is not configured to run. Please edit /etc/default/ipvsadm"
;;
esac
}
stop () {
case $DAEMON in
master|backup)
log_daemon_msg "Stopping IPVS Connection Synchronization Daemon" "$DAEMON"
$IPVSADM --stop-daemon $DAEMON || log_end_msg 1
log_end_msg 0
;;
both)
log_daemon_msg "Stopping IPVS Connection Synchronization Daemon" "master"
$IPVSADM --stop-daemon master || FAILURE=1
log_progress_msg "backup"
$IPVSADM --stop-daemon backup || FAILURE=1
if [ "$FAILURE" -eq 1 ]
then
log_end_msg 1
else
log_end_msg 0
fi
;;
*)
log_action_msg "ipvsadm is not configured to run. Please run dpkg-reconfigure ipvsadm"
;;
esac
}
flush () {
log_action_begin_msg "Clearing the current IPVS table"
ipvsadm -C || log_action_end_msg 1
log_action_end_msg 0
}
load () {
log_action_begin_msg "Loading IPVS configuration"
grep -v "^#" $IPVSADM_RULES | $IPVSADM -R || log_action_end_msg 1
log_action_end_msg 0
}
save () {
log_action_begin_msg "Saving IPVS configuration"
echo "# ipvsadm.rules" > $IPVSADM_RULES
$IPVSADM -S -n >> $IPVSADM_RULES
log_action_end_msg 0
}
if [ -f $IPVSADM_CONFIG ]; then
. $IPVSADM_CONFIG
fi
if [ ! -x $IPVSADM ]; then
exit 0
fi
if [ ! -f $IPVSADM_RULES ]; then
echo "# ipvsadm.rules" > $IPVSADM_RULES
fi
case "$1" in
start)
if [ "$AUTO" = "true" ]; then
flush
load
fi
start
;;
stop)
stop
if [ "$AUTO" = "true" ]; then
flush
fi
;;
restart)
stop
if [ "$AUTO" = "true" ]; then
flush
load
fi
start
;;
reload|force-reload)
if [ "$AUTO" = "true" ]; then
flush
load
fi
;;
status)
ipvsadm -L -n
;;
rate)
ipvsadm -L --rate -n
;;
load)
flush
load
;;
save)
save
;;
*)
echo "Usage: $0
{start|stop|restart|status|rate|load|save|reload|force-reload}"
exit 1
;;
esac
exit 0
|