summaryrefslogtreecommitdiff
path: root/cron-jobs/ftpdir-cleanup
blob: ce91b6207d68a3f114d6cc554739af351dafa1dd (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
#!/bin/bash

#TODO add community
repos="core extra unstable testing"
arches="i686 x86_64"

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: source tarball generation is already in progress (started by $owner)"
	exit 1
fi

trap cleanup 0
trap ctrl_c 2

/bin/touch "$LOCKFILE"

for repo in $repos; do
    for arch in $arches; do
        $(dirname $0)/../misc-scripts/ftpdir-cleanup $repo $arch
    done
done

cleanup