From 22c5f235fa25ea3327d95a28c6dc8ae399d6cb9a Mon Sep 17 00:00:00 2001 From: Aaron Griffin Date: Wed, 28 Apr 2010 12:00:48 -0700 Subject: ftpdir-cleanup: use 'find' for symlink detection This gets rid of a bash loop for link detection --- cron-jobs/ftpdir-cleanup | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) (limited to 'cron-jobs') diff --git a/cron-jobs/ftpdir-cleanup b/cron-jobs/ftpdir-cleanup index 2496ced..977b384 100755 --- a/cron-jobs/ftpdir-cleanup +++ b/cron-jobs/ftpdir-cleanup @@ -40,19 +40,9 @@ for _arch in ${ARCHES[@]}; do cd $poolpath for pkg in *$PKGEXT; do [ -f "$pkg" ] || continue # in case we get a file named "*.pkg.tar.gz" - LINKS="$(/bin/ls $FTP_BASE/*/os/$_arch/$pkg 2>/dev/null)" - if [ -n "$LINKS" ]; then - found=0 - for lnk in $LINKS; do - if [ -h "$lnk" ]; then - found=1 - break - fi - done - # No links found, clean it up - if [ $found -eq 0 ]; then - to_cleanup="$to_cleanup $poolpath/$pkg" - fi + LINKS="$(/usr/bin/find $FTP_BASE -type l -name "$pkg" 2>/dev/null)" + if [ -z "$LINKS" ]; then + to_cleanup="$to_cleanup $poolpath/$pkg" fi done done -- cgit v1.2.3-24-g4f1b