home *** CD-ROM | disk | FTP | other *** search
/ chilidog.highland.cc.ks.us / chilidog.highland.cc.ks.us.zip / chilidog.highland.cc.ks.us / backup / bradford.20120521.etc.tar.gz / bradford.20120521.etc.tar / etc / cron.daily / suse.de-clean-tmp < prev    next >
Text File  |  2005-07-27  |  1KB  |  61 lines

  1. #!/bin/sh
  2. #
  3. #
  4. # clean_tmp. This script was split off cron.daily
  5. # Please add your local changes to cron.daily.local
  6. # since this file will be overwritten, when updating your system.
  7. #
  8. # Copyright (c) 1996-2002 SuSE Linux AG, Nuernberg, Germany.
  9. #
  10. # please send bugfixes or comments to http://www.suse.de/feedback.
  11. #
  12. # Author: Burchard Steinbild, 1996
  13. #         Florian La Roche, 1996
  14. #
  15.  
  16. #
  17. # paranoia settings
  18. #
  19. umask 022
  20.  
  21. PATH=/sbin:/bin:/usr/sbin:/usr/bin
  22. export PATH
  23. #
  24. # get information from /etc/sysconfig
  25. #
  26. if [ -f /etc/sysconfig/cron ] ; then
  27.     . /etc/sysconfig/cron
  28. fi
  29.  
  30. #
  31. # Delete apropriate files in tmp directories.
  32. #
  33. OMIT=""
  34. for i in $OWNER_TO_KEEP_IN_TMP ; do
  35.     OMIT="$OMIT  ( ! -user $i )"
  36. done
  37.  
  38. function cleanup_tmp
  39. {
  40.   MAX_DAYS=$1
  41.   shift
  42.   DIRS_TO_CLEAR="$@"
  43.  
  44.   if [ "$MAX_DAYS" -gt 0 ]; then
  45.     for DIR in $DIRS_TO_CLEAR ; do
  46.       test -x /usr/bin/safe-rm && {
  47.       find $DIR/. $OMIT ! -type d ! -type s ! -type p \
  48.         -atime +$MAX_DAYS -exec /usr/bin/safe-rm {} \;
  49.       } || echo "Error: Can not find /usr/bin/safe-rm"
  50.       find $DIR/. -depth -mindepth 1 $OMIT -type d -empty \
  51.         -mtime +$MAX_DAYS -exec /usr/bin/safe-rmdir {} \;
  52.     done
  53.   fi 
  54. }
  55.  
  56. cleanup_tmp ${MAX_DAYS_IN_TMP:-0} ${TMP_DIRS_TO_CLEAR:-/tmp}
  57. cleanup_tmp ${MAX_DAYS_IN_LONG_TMP:-0} ${LONG_TMP_DIRS_TO_CLEAR}
  58.  
  59. exit 0
  60.  
  61.