updated on Wed Jan 25 16:08:47 UTC 2012
[aur-mirror.git] / ipvsadm / ipvsadm
blob8fae8a4678c1357eaf19640aa86c4a9e8ab5b299
1 #!/bin/bash
3 # source application-specific settings
4 [ -f /etc/conf.d/ipvsadm ] && . /etc/conf.d/ipvsadm
6 . /etc/rc.conf
7 . /etc/rc.d/functions
9 case "$1" in
10 start)
11 if [ ! -f $IPVSADM_CONF ]; then
12 echo "Cannot load ipvsadm rules: $IPVSADM_CONF is missing!" >&2
13 exit 1
15 status "Clearing current IPVS table" /sbin/ipvsadm -C
16 stat_busy "Applying IPVS configuration"
17 /sbin/ipvsadm-restore <$IPVSADM_CONF
18 if [ $? -gt 0 ]; then
19 stat_fail
20 else
21 add_daemon ipvsadm
22 stat_done
25 stop)
26 status "Clearing current IPVS table" /sbin/ipvsadm -C
27 rm_daemon ipvsadm
29 restart)
30 # no need to stop, start will clear the table for us
31 $0 start
33 save)
34 stat_busy "Saving IPVS configuration"
35 /sbin/ipvsadm-save -n >$IPVSADM_CONF 2>/dev/null
36 if [ $? -gt 0 ]; then
37 stat_fail
38 else
39 stat_done
43 echo "usage: $0 {start|stop|restart|save}"
44 esac
45 exit 0