Masato Taruishi
taru****@users*****
2004年 10月 11日 (月) 03:34:55 JST
=================================================================== RCS file: ultrapossum/module/failover/checkstatus,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- ultrapossum/module/failover/checkstatus 2004/04/02 02:34:09 1.2 +++ ultrapossum/module/failover/checkstatus 2004/10/10 18:34:55 1.3 @@ -1,4 +1,4 @@ -#!/usr/bin/perl +#!/usr/bin/env perl # # Copyright (C) 2003 VA Linux Systems Japan, K.K. # @@ -41,7 +41,7 @@ while (<STATUS>) { if (!/^\S+:\d+:\d+:\d+\n$/) { - print "status file is wrong\n"; + print "status file is wrong: $opt_f\n"; exit(1); } $nl++; =================================================================== RCS file: ultrapossum/module/failover/recovery,v retrieving revision 1.6 retrieving revision 1.7 diff -u -r1.6 -r1.7 --- ultrapossum/module/failover/recovery 2004/10/10 18:16:01 1.6 +++ ultrapossum/module/failover/recovery 2004/10/10 18:34:55 1.7 @@ -37,7 +37,9 @@ OWN=$HOST OTHER=$ANOTHER_MASTER -# check replication log of previous master server +echo -n "Checking for recovery status... " 1>&2 + +# check for replication log of previous master server needrecover=0 install -d $RPLDIR/$OWN $RPLDIR/$OTHER $RPLDIR/$OWN/replica $RPLDIR/$OTHER/replica @@ -45,24 +47,29 @@ if ! [ -f $RPLDIR/$OWN/replog ] && [ -f $RPLDIR/$OTHER/replog ]; then $MODULEDIR/failover/checkreplog $RPLDIR/$OTHER/replog $RPLDIR/$OWN/replog || exit 1 needrecover=1 + echo -n "n" 1>&2 fi if [ $RPLDIR/$OTHER/replog -nt $RPLDIR/$OWN/replog ]; then $MODULEDIR/failover/checkreplog $RPLDIR/$OTHER/replog $RPLDIR/$OWN/replog || exit 1 needrecover=1 + echo -n "o" 1>&2 fi if ! [ -f $RPLDIR/$OWN/replica/slurpd.replog ] && [ -f $RPLDIR/$OTHER/replica/slurpd.replog ]; then $MODULEDIR/failover/checkreplog $RPLDIR/$OTHER/replica/slurpd.replog $RPLDIR/$OWN/replica/slurpd.replog || exit 1 needrecover=1 + echo -n "N" 1>&2 fi if [ $RPLDIR/$OTHER/replica/slurpd.replog -nt $RPLDIR/$OWN/replica/slurpd.replog ]; then $MODULEDIR/failover/checkreplog $RPLDIR/$OTHER/replica/slurpd.replog $RPLDIR/$OWN/replica/slurpd.replog || exit 1 needrecover=1 + echo -n "O" 1>&2 fi if [ $RPLDIR/$OTHER/replica/slurpd.status -nt $RPLDIR/$OWN/replica/slurpd.status ]; then + echo -n "s" 1>&2 if $MODULEDIR/failover/checkstatus -f $ULTRAPOSSUM_MASTER_SLAPD_CONF $RPLDIR/$OTHER/replica/slurpd.status then cp $RPLDIR/$OTHER/replica/slurpd.status $RPLDIR/$OWN/replica/slurpd.status || exit 1 @@ -73,19 +80,21 @@ fi fi +echo " done" 1>&2 + # import master data if [ $needrecover -gt 0 ]; then mkdir $TMPDIR/$TMPRPL cp -r $RPLDIR/$OWN/replica $TMPDIR/$TMPRPL cat $RPLDIR/$OWN/replog >> $TMPDIR/$TMPRPL/replica/slurpd.replog if test "`$MODULEDIR/server/startup status`" = "stopped"; then - /etc/init.d/slapd start + $MODULEDIR/server/startup slave_start sleep 1 fi echo "Import master data" 1>&2 echo "replica: $TMPRPL/replica" 1>&2 echo "$SLURPD -d 255 -o -f $CONFDIR/recovery.conf -r $TMPDIR/$TMPRPL/replica/slurpd.replog -t $TMPDIR/$TMPRPL" 1>&2 - if ! $SLURPD -d 255 -o -f $CONFDIR/recovery.conf -r $TMPDIR/$TMPRPL/replica/slurpd.replog -t $TMPDIR/$TMPRPL 2>&1 > $TMPDIR/$TMPRPL/slurpd.log.$$; then + if ! $SHAREDIR/envexec $SLURPD -d 255 -o -f $CONFDIR/recovery.conf -r $TMPDIR/$TMPRPL/replica/slurpd.replog -t $TMPDIR/$TMPRPL 2>&1 > $TMPDIR/$TMPRPL/slurpd.log.$$; then echo "Error: importing slurpd abnormally exitted" 1>&2 cat $TMPDIR/$TMPRPL/slurpd.log.$$ 1>&2 else