blob: d66138ccb558e0affa68b794d8ed0a5a935584d2 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
#!/bin/bash
. "$(dirname $0)/../db-functions"
. "$(dirname $0)/../config"
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"
#adjust the nice level to run at a lower priority
/usr/bin/renice +10 -p $$ > /dev/null
for repo in $repos; do
$(dirname $0)/../misc-scripts/ftpdir-cleanup $repo $CLEANUP_DESTDIR
done
cleanup
|