#!/bin/ksh # $Id: conserver.sh,v 1.5 2010/06/22 20:44:13 anderson Exp $ # $Install(*): ssh %s -lroot '/usr/local/bin/install -cvq -oroot -gbin -m755 - $DESTDIR/etc/init.d/%f' < %f # $InstallRPM: /usr/local/bin/install -cvq -oroot -gbin -m755 - $DESTDIR/etc/init.d/%f < %f # $Link(*): ssh %s -lroot '/sbin/chkconfig --add %f && /sbin/chkconfig --list %f' # chkconfig: 2345 80 80 # description: start/stop the network console-server service # Find our peer -- assume there are only 3 adm hosts, we also # assume that the IPs have a funny relation adm$N is 192.168.248.(10-N) N=`/bin/hostname | sed -e 's,\..*,,' -e 's,^[^0-9]*,,'` N=$((N%3+1)) PEER_IP=192.168.248.$((10-$N)) export N PEER_IP case $1 in start) /usr/local/sbin/conserver -d ;; stop) echo "" | /usr/local/sbin/console -Mlocalhost -Q ;; restart) /usr/local/sbin/console -Y ;; fail-over) ifconfig eth1:1 $PEER_IP netmask 255.255.255.0 ;; fail-back) ifconfig eth1:1 del $PEER_IP ;; *) echo "usage /etc/init.d/conserver {start|stop}" ;; esac