Sisyphus repository
Last update: 23 may 2019 | SRPMs: 17692 | Visits: 13591193
en ru br
ALT Linux repos
S:1.29-alt1
5.0: 1.24-alt1
4.1: 1.24-alt1
4.0: 1.24-alt1

Group :: System/Kernel and hardware
RPM: ipvsadm

 Main   Changelog   Spec   Patches   Sources   Download   Gear   Bugs and FR  Repocop 

#!/bin/sh
#
# Startup script handle the initialisation of LVS
#
# chkconfig: - 08 92
#
# description: Initialise the Linux Virtual Server
# http://www.linuxvirtualserver.org/
#
# Script Author: Horms <horms@vergenet.net>
#
# Based on init script for ipchains by Joshua Jensen <joshua@redhat.com>
#
# Changes:
# Wenzhuo Zhang : fixed the typo of failure function
# LAKostis <lakostis@> : rewrite for ALTLinux
#
# config: /etc/sysconfig/ipvsadm
# config: /etc/ipvsadm.rules

WITHOUT_RC_COMPAT=1

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

# set the configuration file
if [ -f "/etc/sysconfig/ipvsadm" ]; then
IPVSADM_CONFIG="/etc/sysconfig/ipvsadm"
elif [ -f "/etc/ipvsadm.rules" ]; then
IPVSADM_CONFIG="/etc/ipvsadm.rules"
else
IPVSADM_CONFIG="/etc/sysconfig/ipvsadm"
fi

RETVAL=0

start()
{
action "Applying IPVS configuration: "
ipvsadm-restore < "$IPVSADM_CONFIG" && \
success "Applying IPVS configuration" || \
failure "Applying IPVS configuration"
RETVAL=$?
return $RETVAL
}

stop()
{
action "Clearing the current IPVS table:" ipvsadm -C
RETVAL=$?
return $RETVAL
}

save()
{
action "Saving IPVS table to $IPVSADM_CONFIG: "
ipvsadm-save -n > $IPVSADM_CONFIG 2>/dev/null && \
success "Saving IPVS table to $IPVSADM_CONFIG" || \
failure "Saving IPVS table to $IPVSADM_CONFIG"
RETVAL=$?
return $RETVAL
}

case "$1" in
start)
start
[ $RETVAL -eq 0 ] && touch $LOCKFLE
;;

stop)
stop
[ $RETVAL -eq 0 ] && rm -f $LOCKFILE
;;

reload|restart)
stop
start
;;

panic)
# I'm not sure what panic does but in the case of IPVS
# it makes sense just to clear everything
action "Clearing the current IPVS table:" ipvsadm -C
;;
condstop)
if [ -e "$LOCKFILE" ]; then
stop
fi
;;
condreload|condrestart)
if [ -e "$LOCKFILE" ]; then
restart
fi
;;
status)
ipvsadm -L -n
;;
save)
save
;;

*)
msg_usage "${0##*/} {start|stop|restart|reload|condstop|condreload|condrestart|status|panic|save}"
RETVAL=1
esac

exit $RETVAL

 
design & coding: Vladimir Lettiev aka crux © 2004-2005, Andrew Avramenko aka liks © 2007-2008
current maintainer: Michael Shigorin