summaryrefslogtreecommitdiff
path: root/cron-jobs
diff options
context:
space:
mode:
Diffstat (limited to 'cron-jobs')
-rwxr-xr-xcron-jobs/ftpdir-cleanup26
1 files changed, 3 insertions, 23 deletions
diff --git a/cron-jobs/ftpdir-cleanup b/cron-jobs/ftpdir-cleanup
index 546afd9..f5e401a 100755
--- a/cron-jobs/ftpdir-cleanup
+++ b/cron-jobs/ftpdir-cleanup
@@ -5,34 +5,14 @@
repos="$(get_repos_for_host)"
-LOCKFILE="/tmp/.ftpdircleanup.lock"
-
-cleanup () {
- rm -f "$LOCKFILE"
- exit 0
-}
-
-ctrl_c() {
- cleanup
-}
-
-if [ -f "$LOCKFILE" ]; then
- owner="$(/usr/bin/stat -c %U $LOCKFILE)"
- echo "error: ftp cleanup is already in progress (started by $owner)"
- exit 1
-fi
-
-trap cleanup 0
-trap ctrl_c 2
-
-/bin/touch "$LOCKFILE"
+script_lock
#adjust the nice level to run at a lower priority
/usr/bin/renice +10 -p $$ > /dev/null
repopaths=''
for repo in $repos; do
- $(dirname $0)/../misc-scripts/ftpdir-cleanup $repo
+ $(dirname $0)/../misc-scripts/ftpdir-cleanup-repo $repo
repopaths="${repopaths} ${FTP_BASE}/${repo}/os/"
done
@@ -60,4 +40,4 @@ if [ -n "$to_cleanup" ]; then
mv $to_cleanup "$CLEANUP_DESTDIR"
fi
-cleanup
+script_unlock