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 / init.d / boot.cleanup < prev    next >
Text File  |  2005-10-13  |  3KB  |  110 lines

  1. #! /bin/sh
  2. #
  3. # Copyright (c) 2001-2005 SuSE Linux AG, Nuernberg, Germany.
  4. # All rights reserved.
  5. #
  6. # /etc/init.d/boot.cleanup
  7. #
  8. ### BEGIN INIT INFO
  9. # Provides:          boot.cleanup
  10. # Required-Start:    boot.localfs
  11. # Should-Start:      boot.quota
  12. # Required-Stop:
  13. # Default-Start:     B
  14. # Default-Stop:
  15. # Description:       do cleanup
  16. ### END INIT INFO
  17.  
  18. . /etc/rc.status
  19. . /etc/sysconfig/cron
  20.  
  21. rc_reset
  22.  
  23. case "$1" in
  24.   start)
  25.     #
  26.     # clean up
  27.     #
  28.     rm -f /var/lib/rpm/__db*
  29.     rm -rf /tmp/screens /tmp/uscreens /var/run/screens /var/run/uscreens 2>/dev/null
  30.     rm -f /tmp/.X*lock /var/spool/uucp/LCK* /var/log/sa/sadc.LOCK /fsck_corrected_errors 2>/dev/null
  31.     if test -x /usr/bin/find -a -x /usr/bin/xargs ; then
  32.         find /tmp/ssh-* -type s -name "*agent*" -maxdepth 1 -print0 2>/dev/null | xargs -0 -r rm -f
  33.         find /var/run /var/lock -type f -print0 | xargs -0 -r rm -f 2>/dev/null
  34.     else
  35.         # fallback for find if we get /usr from nfs
  36.         rec_rem() {
  37.         for f in "$1"/*
  38.         do
  39.         test -L "$f" && continue
  40.         test -f "$f" && rm -f "$f"
  41.         test -d "$f" && rec_rem "$f"
  42.         done
  43.         }
  44.         #
  45.         test -d /var/run && rec_rem /var/run
  46.         test -d /var/lock && rec_rem /var/lock
  47.     fi
  48.     : > /var/run/utmp
  49.     chmod 664 /var/run/utmp
  50.     chown root:tty /var/run/utmp
  51.     # Restore a possibly dynamically modified /etc/resolv.conf
  52.     if ls /etc/resolv.conf.saved.by.* &>/dev/null ; then
  53.         echo "Cleaning up using /sbin/modify_resolvconf:"
  54.         /sbin/modify_resolvconf cleanup
  55.         echo -e "$rc_done_up"
  56.     fi
  57.     # delete temp files
  58.     # If $CLEAR_TMP_DIRS_AT_BOOTUP = yes, delete files in
  59.     # $TMP_DIRS_TO_CLEAR, if $CLEAR_TMP_DIRS_AT_BOOTUP starts with a "/"
  60.     # delete files in those dirs instead.
  61.     CLEAR_DIRS="$TMP_DIRS_TO_CLEAR"
  62.     if [ "${CLEAR_TMP_DIRS_AT_BOOTUP:0:1}" = "/" ]; then
  63.       CLEAR_DIRS="$CLEAR_TMP_DIRS_AT_BOOTUP"
  64.       CLEAR_TMP_DIRS_AT_BOOTUP=yes
  65.     fi
  66.     if test -x /usr/bin/find -a -x /usr/bin/xargs ; then
  67.         if test "$CLEAR_TMP_DIRS_AT_BOOTUP" = yes; then
  68.         echo -n "Cleaning temporary directories $CLEAR_DIRS"
  69.         for CURDIR in $CLEAR_DIRS ; do
  70.             find $CURDIR -maxdepth 1 -printf '%P\0' | ( cd $CURDIR ; xargs -0 rm -rf -- )
  71.         done
  72.         rc_status -v -r
  73.         fi
  74.     fi
  75.     for CURDIR in /tmp /tmp/.X11-unix /tmp/.ICE-unix \
  76.               /var/tmp /var/tmp/vi.recover /var/run/uscreens ; do
  77.         test -d $CURDIR || \
  78.         mkdir $CURDIR && \
  79.         chown root:root $CURDIR && \
  80.         chmod 1777 $CURDIR
  81.     done
  82.     for CURDIR in /var/run/screens ; do
  83.         test -d $CURDIR || \
  84.         mkdir $CURDIR && \
  85.         chown root:root $CURDIR && \
  86.         chmod 755 $CURDIR
  87.     done
  88.     
  89.     #
  90.     # there could be a new kernel version.  reinit /etc/psdevtab, to be sure.
  91.     #
  92.     rm -f /etc/psdevtab
  93.     test -x /bin/ps && /bin/ps > /dev/null 2> /dev/null
  94.     ;;
  95.     stop|restart)
  96.         # skip / nothing to do
  97.     ;;
  98.     status)
  99.     rc_failed 4
  100.     rc_status -v
  101.     ;;
  102.     *)
  103.     echo "Usage: $0 {start|stop|status|restart}"
  104.     exit 1
  105.     ;;
  106. esac
  107.  
  108. rc_exit
  109.     
  110.