summaryrefslogtreecommitdiffstats
path: root/misc-scripts/ftpdir-cleanup
diff options
context:
space:
mode:
authorPierre Schmitz <pierre@archlinux.de>2010-04-11 13:52:32 +0200
committerPierre Schmitz <pierre@archlinux.de>2010-04-11 13:52:32 +0200
commitad520b527f3c5d2471e4b471eca5439643a01939 (patch)
tree9ab80ba4aa1537fa53c89093761473e3a0c1a49c /misc-scripts/ftpdir-cleanup
parent154b5301ff08ef29ff69afc17789a4f1a6a00c20 (diff)
downloaddbscripts-ad520b527f3c5d2471e4b471eca5439643a01939.tar.gz
dbscripts-ad520b527f3c5d2471e4b471eca5439643a01939.tar.xz
Fail if lock couldn't be obtained; Unlock the repos if ftpdir-cleanup fails
Diffstat (limited to 'misc-scripts/ftpdir-cleanup')
-rwxr-xr-xmisc-scripts/ftpdir-cleanup13
1 files changed, 12 insertions, 1 deletions
diff --git a/misc-scripts/ftpdir-cleanup b/misc-scripts/ftpdir-cleanup
index 4c559b9..d5f5737 100755
--- a/misc-scripts/ftpdir-cleanup
+++ b/misc-scripts/ftpdir-cleanup
@@ -13,13 +13,24 @@ dest=$2
. "$(dirname $0)/../db-functions"
. "$(dirname $0)/../config"
+cleanup() {
+ trap '' 2 15
+ for arch in ${ARCHES[@]}; do
+ repo_unlock $reponame $arch
+ done
+ exit 1
+}
+
+trap cleanup 2
+trap cleanup 15
+
${CLEANUP_DRYRUN} && echo 'dry run mode is active'
ftppath_base="$FTP_BASE/$reponame/$FTP_OS_SUFFIX"
for arch in ${ARCHES[@]}; do
- repo_lock $reponame $arch $LOCK_TIMEOUT
+ repo_lock $reponame $arch $LOCK_TIMEOUT || continue
TMPDIR=$(mktemp -d /tmp/cleanup-XXXXXX) || exit 1
ftppath="$ftppath_base/$arch"