[scripts] signal stale processes to stderr
This commit is contained in:
parent
7d545ee026
commit
4fed801c40
@ -3,10 +3,10 @@ SABAYON_MOLECULE_HOME="${SABAYON_MOLECULE_HOME:-/sabayon}"
|
|||||||
. "${SABAYON_MOLECULE_HOME}/scripts/iso_build.include"
|
. "${SABAYON_MOLECULE_HOME}/scripts/iso_build.include"
|
||||||
|
|
||||||
(
|
(
|
||||||
flock --timeout 7200 -x 9
|
flock --timeout ${LOCK_TIMEOUT} -x 9
|
||||||
if [ "${?}" != "0" ]; then
|
if [ "${?}" != "0" ]; then
|
||||||
echo "[cleanup] cannot acquire lock, stale process holding it?" >&2
|
echo "[cleanup] cannot acquire lock, stale process holding it?" >&2
|
||||||
exit 1
|
kill_stale_process || exit 1
|
||||||
fi
|
fi
|
||||||
"${SABAYON_MOLECULE_HOME}/scripts/cleanup_pkgcache.sh"
|
"${SABAYON_MOLECULE_HOME}/scripts/cleanup_pkgcache.sh"
|
||||||
) 9> "${ISO_BUILD_LOCK}"
|
) 9> "${ISO_BUILD_LOCK}"
|
||||||
|
@ -1,3 +1,11 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
ISO_BUILD_LOCK=/tmp/.daily_iso_build.sh.lock
|
ISO_BUILD_LOCK=/tmp/.daily_iso_build.sh.lock
|
||||||
|
LOCK_TIMEOUT=$((3600 * 2)) # 2 hours
|
||||||
|
|
||||||
|
kill_stale_process() {
|
||||||
|
echo "[kill] NOT killing stale process automatically for NOW" >&2
|
||||||
|
#local inode=$(stat -L --format '%i' "${ISO_BUILD_LOCK}") # ignore device...
|
||||||
|
#local pids=$(cat /proc/locks | grep ":${inode}" | awk '{ print $5 }')
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
@ -12,20 +12,20 @@ SABAYON_MOLECULE_HOME="${SABAYON_MOLECULE_HOME:-/sabayon}"
|
|||||||
|
|
||||||
# Pull new data from Git
|
# Pull new data from Git
|
||||||
(
|
(
|
||||||
flock --timeout 7200 -x 9
|
flock --timeout ${LOCK_TIMEOUT} -x 9
|
||||||
if [ "${?}" != "0" ]; then
|
if [ "${?}" != "0" ]; then
|
||||||
echo "[git pull] cannot acquire lock, stale process holding it?" >&2
|
echo "[git pull] cannot acquire lock, stale process holding it?" >&2
|
||||||
exit 1
|
kill_stale_process || exit 1
|
||||||
fi
|
fi
|
||||||
cd /sabayon && git pull --quiet
|
cd /sabayon && git pull --quiet
|
||||||
) 9> "${ISO_BUILD_LOCK}"
|
) 9> "${ISO_BUILD_LOCK}"
|
||||||
|
|
||||||
# Execute build
|
# Execute build
|
||||||
(
|
(
|
||||||
flock --timeout 7200 -x 9
|
flock --timeout ${LOCK_TIMEOUT} -x 9
|
||||||
if [ "${?}" != "0" ]; then
|
if [ "${?}" != "0" ]; then
|
||||||
echo "[build] cannot acquire lock, stale process holding it?" >&2
|
echo "[build] cannot acquire lock, stale process holding it?" >&2
|
||||||
exit 1
|
kill_stale_process || exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
"${SABAYON_MOLECULE_HOME}/scripts/${BUILD_SCRIPT_NAME}"
|
"${SABAYON_MOLECULE_HOME}/scripts/${BUILD_SCRIPT_NAME}"
|
||||||
|
Loading…
Reference in New Issue
Block a user