[scripts] add cleanup_pkgcache_locked.sh, move locking from crontab
This commit is contained in:
parent
e4cef07575
commit
7d545ee026
@ -4,7 +4,6 @@
|
||||
|
||||
# Path to molecules.git dir
|
||||
SABAYON_MOLECULE_HOME="${SABAYON_MOLECULE_HOME:-/sabayon}"
|
||||
export SABAYON_MOLECULE_HOME
|
||||
|
||||
DIR="${SABAYON_MOLECULE_HOME}/pkgcache"
|
||||
find "${DIR}" -atime +30 -type f -delete
|
||||
|
14
scripts/cleanup_pkgcache_locked.sh
Executable file
14
scripts/cleanup_pkgcache_locked.sh
Executable file
@ -0,0 +1,14 @@
|
||||
# Path to molecules.git dir
|
||||
SABAYON_MOLECULE_HOME="${SABAYON_MOLECULE_HOME:-/sabayon}"
|
||||
. "${SABAYON_MOLECULE_HOME}/scripts/iso_build.include"
|
||||
|
||||
(
|
||||
flock --timeout 7200 -x 9
|
||||
if [ "${?}" != "0" ]; then
|
||||
echo "[cleanup] cannot acquire lock, stale process holding it?" >&2
|
||||
exit 1
|
||||
fi
|
||||
"${SABAYON_MOLECULE_HOME}/scripts/cleanup_pkgcache.sh"
|
||||
) 9> "${ISO_BUILD_LOCK}"
|
||||
|
||||
exit ${?}
|
Loading…
Reference in New Issue
Block a user