Sophie

Sophie

distrib > Mandriva > 9.1 > ppc > by-pkgid > d0517d529c9fb1b6ea305fae2b6ce24f > files > 2

iptoip-0.3.0-0.3mdk.noarch.rpm

#!/bin/sh
#
# iptoip       This shell script takes care of loading or saving
#           Linux Virtual Server Rules
#
# chkconfig: 2345 80 30
#
# description: Loading Linux Virtual Server rules.
#
# (c) MandrakeSoft, Philippe Libat <philippe@mandrakesoft.com>
#
# config default: /etc/iptoip.xml

# Source function library.
. /etc/rc.d/init.d/functions

# Source networking configuration.
[ ! -f /etc/sysconfig/network ] && exit 1
. /etc/sysconfig/network

# Check that networking is up.
[ ${NETWORKING} = "no" ] && exit 1

# Check Linux Virtual Server Rules
[ ! -f /etc/iptoip.xml ] && exit 1
IPVSADM_CONFIG=/etc/iptoip.xml

# Check ipvsadm
[ ! -x /sbin/ipvsadm ] && exit 1
IPVSADM=/sbin/ipvsadm

[ ! -x /usr/sbin/iptoip ] && exit 1
IPTOIP=/usr/sbin/iptoip


case "$1" in
    start)
		[ "`cat /proc/sys/net/ipv4/ip_forward`" = 0 ] && {
		  failure "IPv4 packet forwarding disabled"
		  exit 1;}
		success "IPv4 packet forwarding enabled"
		action "Flushing all current rules :" $IPVSADM -C
		action "Applying ipvsadm rules from %s:" "$IPVSADM_CONFIG" $IPTOIP --file $IPVSADM_CONFIG
		echo
		touch /var/lock/subsys/iptoip
    ;;
    stop)
			action "Flushing all chains:" $IPVSADM -C
			echo
			rm -f /var/lock/subsys/iptoip
    ;;  
	status)
			$IPVSADM -L -n
    ;;
	restart|reload)
    $0 stop
    $0 start
    ;;

    *)
        gprintf "Usage: %s {start|stop|status|restart|reload}\n" "$0"
        exit 1
	;;
esac

exit 0