#!/usr/bin/env bash # Questo script aggiunge il routing per gli IP failover assegnati alle macchine dedicate. # Basic support for IRIX style chkconfig ### # chkconfig: 235 49 08 # description: Aggiunge il routing per gli IP assegnati alle macchine dedicate ### # Basic support for the Linux Standard Base Specification 1.3 # Used by insserv and other LSB compliant tools. ### BEGIN INIT INFO # Provides: VMware-Routing # Required-Start: $network $syslog VMware # Required-Stop: # Default-Start: 2 3 5 # Default-Stop: 0 6 # Short-Description: Aggiunge il routing per gli IP assegnati alle macchine dedicate # Description: Aggiunge il routing per gli IP assegnati alle macchine dedicate ### END INIT INFO # BEGINNING_OF_UTIL_DOT_SH #!/bin/sh vmware_routes_start() { echo "Starting VMWare Routes... " while [ "$v" != "1" ]; do v=$(ifconfig | grep -c vmnet1) echo "Waiting for vmnet1" if [ "$v" != "1" ]; then sleep 5; fi done if [ -e /etc/vmware/routes.conf ]; then for address in `egrep -v "^#" /etc/vmware/routes.conf | awk '{ print $1 }'`; do /sbin/ip route add $address dev vmnet1 done fi sysctl -p /etc/sysctl.conf echo "Routes have been added" } vmware_routes_stop() { echo "Stopping VMWare Routes..." if [ -e /etc/vmware/routes.conf ]; then for address in `egrep -v "^#" /etc/vmware/routes.conf | awk '{ print $1 }'`; do /sbin/ip route del $address dev vmnet1 done fi echo "Done" } case "$1" in start) vmware_routes_start ;; stop) vmware_routes_stop ;; restart) vmware_routes_stop sleep 1 vmware_routes_start ;; *) echo "Usage: check {start|stop|restart}" exit 1 esac exit 0