mirror of https://github.com/CGAL/cgal
More check of the lock file in autotest_cgal: the lock file will now
contain the PID of the running autotest_cgal process. That PID can be checked and displayed if the lock cannot be acquired.
This commit is contained in:
parent
0603ea69f7
commit
680ae36873
|
|
@ -863,11 +863,24 @@ else
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Acquire lock
|
# Acquire lock
|
||||||
lockfile -r 5 "$LOCK_FILE";
|
lockfile -r 1 "$LOCK_FILE";
|
||||||
if [ ${?} != 0 ]; then
|
if [ ${?} != 0 ]; then
|
||||||
echo "COULD NOT AQUIRE LOCK!";
|
PID=`cat "$LOCK_FILE"`
|
||||||
exit 1;
|
if kill -0 "$PID"; then
|
||||||
|
log "COULD NOT AQUIRE LOCK! LOCKING PROCESS PID=$PID";
|
||||||
|
exit 1;
|
||||||
|
else
|
||||||
|
# The locking process has died without erasing the lock file
|
||||||
|
rm -f "$LOCK_FILE"
|
||||||
|
lockfile -r 1 "$LOCK_FILE";
|
||||||
|
if [ ${?} != 0 ]; then
|
||||||
|
log "COULD NOT AQUIRE LOCK!";
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
# Put the PID of current process in the lock file
|
||||||
|
echo $$ >> "$LOCK_FILE"
|
||||||
|
|
||||||
# that line makes the script remove the lock file in case of unwanted exit
|
# that line makes the script remove the lock file in case of unwanted exit
|
||||||
trap "rm -f $LOCK_FILE" EXIT HUP INT TERM
|
trap "rm -f $LOCK_FILE" EXIT HUP INT TERM
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue