forked from extern/shorewall_code
Leave lock file after timeout
git-svn-id: https://shorewall.svn.sourceforge.net/svnroot/shorewall/trunk@149 fbd18981-670d-0410-9b5c-8dc0c1a9a2bb
This commit is contained in:
parent
621e8df85b
commit
b698fe4d6f
@ -116,7 +116,7 @@ get_statedir()
|
|||||||
mutex_on()
|
mutex_on()
|
||||||
{
|
{
|
||||||
local try=0
|
local try=0
|
||||||
local max=15
|
local max=30
|
||||||
local int=2
|
local int=2
|
||||||
|
|
||||||
local lockf=$STATEDIR/lock
|
local lockf=$STATEDIR/lock
|
||||||
@ -124,7 +124,7 @@ mutex_on()
|
|||||||
[ -d $STATEDIR ] || mkdir -p $STATEDIR
|
[ -d $STATEDIR ] || mkdir -p $STATEDIR
|
||||||
|
|
||||||
if qt which lockfile; then
|
if qt which lockfile; then
|
||||||
lockfile -030 -r1 ${lockf} || rm -f ${lockf}
|
lockfile -060 -r1 ${lockf}
|
||||||
else
|
else
|
||||||
while [ -f ${lockf} -a ${try} -lt ${max} ] ; do
|
while [ -f ${lockf} -a ${try} -lt ${max} ] ; do
|
||||||
sleep ${int}
|
sleep ${int}
|
||||||
@ -136,7 +136,6 @@ mutex_on()
|
|||||||
echo $$ > ${lockf}
|
echo $$ > ${lockf}
|
||||||
else
|
else
|
||||||
echo "Giving up on lock file ${lockf}" >&2
|
echo "Giving up on lock file ${lockf}" >&2
|
||||||
rm -f ${lockf}
|
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user