mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
Fix domr's file lock
And add more information for domr's file lock
This commit is contained in:
parent
495e9ad113
commit
f98191be5c
@ -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
|
||||
}
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user