home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Chip 2007 January, February, March & April
/
Chip-Cover-CD-2007-02.iso
/
boot
/
i386
/
rescue
/
etc
/
init.d
/
boot.cleanup
< prev
next >
Wrap
Text File
|
2006-11-29
|
3KB
|
114 lines
#! /bin/sh
#
# Copyright (c) 2001-2005 SuSE Linux AG, Nuernberg, Germany.
# All rights reserved.
#
# /etc/init.d/boot.cleanup
#
### BEGIN INIT INFO
# Provides: boot.cleanup
# Required-Start: boot.rootfsck
# Should-Start: $local_fs boot.quota
# Required-Stop:
# Default-Start: B
# Default-Stop:
# Description: do cleanup
### END INIT INFO
. /etc/rc.status
. /etc/sysconfig/cron
rc_reset
case "$1" in
start)
#
# clean up
#
rm -f /var/lib/rpm/__db*
rm -rf /tmp/screens /tmp/uscreens /var/run/screens /var/run/uscreens 2>/dev/null
rm -f /tmp/.X*lock /var/spool/uucp/LCK* /var/log/sa/sadc.LOCK /fsck_corrected_errors 2>/dev/null
if test -x /usr/bin/find -a -x /usr/bin/xargs ; then
find /tmp/ssh-* -type s -name "*agent*" -maxdepth 1 -print0 2>/dev/null | xargs -0 -r rm -f
find /var/run /var/lock -type f -print0 | xargs -0 -r rm -f 2>/dev/null
else
# fallback for find if we get /usr from nfs
rec_rem() {
for f in "$1"/*
do
test -L "$f" && continue
test -f "$f" && rm -f "$f"
test -d "$f" && rec_rem "$f"
done
}
#
test -d /var/run && rec_rem /var/run
test -d /var/lock && rec_rem /var/lock
fi
: > /var/run/utmp
chmod 664 /var/run/utmp
chown root:tty /var/run/utmp
# Re-read inittab for jobs and redo utmp records if required
test "$PREVLEVEL" = "S" && telinit q
# Restore a possibly dynamically modified /etc/resolv.conf
if ls /etc/resolv.conf.saved.by.* &>/dev/null ; then
echo "Cleaning up using /sbin/modify_resolvconf:"
/sbin/modify_resolvconf cleanup
echo -e "$rc_done_up"
fi
# delete temp files
# If $CLEAR_TMP_DIRS_AT_BOOTUP = yes, delete files in
# $TMP_DIRS_TO_CLEAR, if $CLEAR_TMP_DIRS_AT_BOOTUP starts with a "/"
# delete files in those dirs instead.
CLEAR_DIRS="$TMP_DIRS_TO_CLEAR"
if [ "${CLEAR_TMP_DIRS_AT_BOOTUP:0:1}" = "/" ]; then
CLEAR_DIRS="$CLEAR_TMP_DIRS_AT_BOOTUP"
CLEAR_TMP_DIRS_AT_BOOTUP=yes
fi
if test -x /usr/bin/find -a -x /usr/bin/xargs ; then
if test "$CLEAR_TMP_DIRS_AT_BOOTUP" = yes; then
echo -n "Cleaning temporary directories $CLEAR_DIRS"
for CURDIR in $CLEAR_DIRS ; do
find $CURDIR -maxdepth 1 -printf '%P\0' | ( cd $CURDIR ; xargs -0 rm -rf -- )
done
rc_status -v -r
fi
fi
for CURDIR in /tmp /tmp/.X11-unix /tmp/.ICE-unix \
/var/tmp /var/tmp/vi.recover /var/run/uscreens ; do
test -d $CURDIR || \
mkdir $CURDIR && \
chown root:root $CURDIR && \
chmod 1777 $CURDIR
done
for CURDIR in /var/run/screens ; do
test -d $CURDIR || \
mkdir $CURDIR && \
chown root:root $CURDIR && \
chmod 755 $CURDIR
done
#
# there could be a new kernel version. reinit /etc/psdevtab, to be sure.
#
rm -f /etc/psdevtab
test -x /bin/ps && /bin/ps > /dev/null 2> /dev/null
;;
stop|restart)
# skip / nothing to do
;;
status)
rc_failed 4
rc_status -v
;;
*)
echo "Usage: $0 {start|stop|status|restart}"
exit 1
;;
esac
rc_exit