diff options
author | Luke Shumaker <lukeshu@parabola.nu> | 2018-09-25 02:40:02 -0400 |
---|---|---|
committer | Luke Shumaker <lukeshu@parabola.nu> | 2018-09-25 02:40:41 -0400 |
commit | 3540ddbf4c2dc25903f3d4f23a86dd795ae620e2 (patch) | |
tree | 7c25978ab67470704a9276190d0a57fbc7d919b7 | |
parent | 3120c7bd8ce158f5dd482deef3b69441cf5a117d (diff) |
Teach db-cleanup to clean old torrents, rather than having make_repo_torrents do it
-rwxr-xr-x | cron-jobs/db-cleanup | 2 | ||||
-rwxr-xr-x | cron-jobs/make_repo_torrents | 14 | ||||
-rw-r--r-- | db-cleanup.conf | 9 |
3 files changed, 8 insertions, 17 deletions
diff --git a/cron-jobs/db-cleanup b/cron-jobs/db-cleanup index de92e21..fc7fd25 100755 --- a/cron-jobs/db-cleanup +++ b/cron-jobs/db-cleanup @@ -40,7 +40,7 @@ done | cut -d'/' -f1 | sort -u | sed "s|$|*|" > "$filter" msg "Removing old files:" -for POOL in "${PKGPOOLS[@]}" "${SRCPOOLS[@]}"; do +for POOL in "${PKGPOOLS[@]}" "${SRCPOOLS[@]}" "${TORRENTPOOLS[@]}"; do msg2 '%s' "${POOL}" rsync "${EXTRAFLAGS[@]}" -va --delete-excluded \ diff --git a/cron-jobs/make_repo_torrents b/cron-jobs/make_repo_torrents index 8c79df2..11776ab 100755 --- a/cron-jobs/make_repo_torrents +++ b/cron-jobs/make_repo_torrents @@ -43,17 +43,3 @@ for pkgfile in "$FTP_BASE"/pool/*/*${PKGEXTS}; do -- "${pkgfile}" >/dev/null fi done - -# For torrents older than 1 year, we check if it's package still -# exists, else clean it up. This shouldn't be done every hour. So we -# do it with a 1-in-30 probability. -if ! (( $(shuf -e {0..29} | head -1) )); then - while read -r torrent; do - pkgfile="${torrent##*/}" - pkgfile="${torrent%.torrent}" - - if ! is_globfile "$FTP_BASE"/pool/*/"$pkgfile"; then - rm -f -- "$torrent" - fi - done < <(find -H . -mtime +365 -name '*.torrent' -type f) -fi diff --git a/db-cleanup.conf b/db-cleanup.conf index 12d65f9..9944438 100644 --- a/db-cleanup.conf +++ b/db-cleanup.conf @@ -1,6 +1,6 @@ #!/hint/bash -# Both PKGPOOLS and SRCPOOLS are relative to `config:FTP_BASE`. +# All `*POOLS` variables are relative to `config:FTP_BASE`. # Directories where packages are shared between repos PKGPOOLS=( @@ -11,7 +11,7 @@ PKGPOOLS=( pool/community # Arch Linux (community) ) -# Directories where sources are stored +# Directories where source-packages are stored SRCPOOLS=( sources/parabola # Parabola GNU/Linux-libre sources/alarm # Arch Linux ARM @@ -19,3 +19,8 @@ SRCPOOLS=( sources/packages # Arch Linux (project) sources/community # Arch Linux (community) ) + +# Directories where torrents are stored +TORRENTPOOLS=( + torrents +) |