diff --git a/patches/systemvm/debian/config/root/func.sh b/patches/systemvm/debian/config/root/func.sh index 7fb797c10ac..486d2f62773 100644 --- a/patches/systemvm/debian/config/root/func.sh +++ b/patches/systemvm/debian/config/root/func.sh @@ -24,7 +24,8 @@ getLockFile() { return fi - touch $__LOCKFILE + psline=`ps u $$` + echo $psline > $__LOCKFILE for i in `seq 1 $(($__TIMEOUT * 10))` do @@ -43,8 +44,11 @@ getLockFile() { if [ $__locked -ne 1 ] then logger -t cloud "fail to acquire the lock $1 for process $0 pid $$ after $__TIMEOUT seconds time out!" + cmd=`cat $currlock` + logger -t cloud "waiting for command: $cmd" psline=`ps u $$` logger -t cloud "Failed job detail: $psline" + rm $__LOCKFILE fi echo $__locked } diff --git a/patches/systemvm/debian/config/root/ipassoc.sh b/patches/systemvm/debian/config/root/ipassoc.sh index 17278a3fd9b..9b5472b7501 100644 --- a/patches/systemvm/debian/config/root/ipassoc.sh +++ b/patches/systemvm/debian/config/root/ipassoc.sh @@ -260,7 +260,7 @@ grep "redundant_router=1" /var/cache/cloud/cmdline > /dev/null if [ $? -eq 0 ] then is_redundant=1 - sudo /root/checkrouter.sh|grep "Status: MASTER" > /dev/null 2>&1 + sudo /root/checkrouter.sh --no-lock|grep "Status: MASTER" > /dev/null 2>&1 if [ $? -eq 0 ] then is_master=1 diff --git a/patches/systemvm/debian/config/root/redundant_router/checkrouter.sh.templ b/patches/systemvm/debian/config/root/redundant_router/checkrouter.sh.templ index c1baf191ec4..ae22ec7629d 100755 --- a/patches/systemvm/debian/config/root/redundant_router/checkrouter.sh.templ +++ b/patches/systemvm/debian/config/root/redundant_router/checkrouter.sh.templ @@ -2,11 +2,23 @@ source /root/func.sh -lock="biglock" -locked=$(getLockFile $lock) -if [ "$locked" != "1" ] +nolock=0 +if [ $# -eq 1 ] then - exit 1 + if [ $1 == "--no-lock" ] + then + nolock=1 + fi +fi + +if [ $nolock -eq 0 ] +then + lock="biglock" + locked=$(getLockFile $lock) + if [ "$locked" != "1" ] + then + exit 1 + fi fi bumped="Bumped: NO" @@ -21,4 +33,7 @@ then echo "$stat&$bumped" fi -unlock_exit $? $lock $locked +if [ $nolock -eq 0 ] +then + unlock_exit $? $lock $locked +fi