]>
git.ipfire.org Git - people/ms/nightly-builds.git/blob - server-scripts/ipfire-cleanup-nightly-builds.sh
3abe283622e538283d7eff214ff5d438c8fa01cf
5 MAX_AGE
=$
(( 7 * 24 * 3600 )) # 7 days
10 for build
in $
(find "${BASEDIR}" -mindepth 2 -maxdepth 2 -type d |
sort -nr); do
11 time="$(basename "${build}")"
12 [ "${time}" = "latest" ] && continue
14 # Never delete the last two builds
15 if [ "${counter}" -lt 2 ]; then
16 counter
=$
(( ${counter} + 1 ))
20 # Determine age of the build
21 change
="$(stat --format="%Y
" "${build}")"
22 age
=$
(( ${NOW} - ${change} ))
24 # If the build is old enough we will delete it
25 if [[ ${age} -ge ${MAX_AGE} ]]; then