diff options
author | Aaron Griffin <aaronmgriffin@gmail.com> | 2010-04-28 21:00:48 +0200 |
---|---|---|
committer | Aaron Griffin <aaronmgriffin@gmail.com> | 2010-04-28 21:00:48 +0200 |
commit | 22c5f235fa25ea3327d95a28c6dc8ae399d6cb9a (patch) | |
tree | be1dc79db8b8008ed5c7c475bded05b40552f634 | |
parent | 709b4a514e24620145756a312ef9aab0662a3d8f (diff) | |
download | dbscripts-22c5f235fa25ea3327d95a28c6dc8ae399d6cb9a.tar.gz dbscripts-22c5f235fa25ea3327d95a28c6dc8ae399d6cb9a.tar.xz |
ftpdir-cleanup: use 'find' for symlink detection
This gets rid of a bash loop for link detection
-rwxr-xr-x | cron-jobs/ftpdir-cleanup | 16 |
1 files changed, 3 insertions, 13 deletions
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 |