Files
initscripts/SRC/initscripts/init.d/cleanfs
Jay Larson 3112172beb This package has gone through significant changes:
* Re-wrote/cleaned up init scripts
  * Re-wrote init-functions
  * Moved some things (init scripts, defaults, configs) to other packages
  * Added update-rc which manages /etc/rc* directories
  * Added usher to manage defaults
2017-05-16 16:44:05 -05:00

41 lines
725 B
Bash
Executable File

#!/bin/sh
### BEGIN INIT INFO
# Provides: cleanfs
# Required-Start: $local_fs
# Required-Stop:
# Should-Start:
# Should-Stop:
# Default-Start: S
# Default-Stop:
# Short-Description: Clean temporary directories
# X-Required: true
### END INIT INFO
. /lib/lsb/init-functions
[ -z "$CLEANDIRS" ] && exit 0
clean() {
[ -d $1 ] || return 1
cd $1 && find . -xdev -mindepth 1 ! -name lost+found -delete || return 1
return 0
}
case "$1" in
start)
log_init_msg "Cleaning temporary files"
for dir in $CLEANDIRS; do
clean $dir || error=1
done
[ -z $error ] && log_success_msg || log_failure_msg
;;
*)
echo "Usage: $0 [start]"
exit 1
;;
esac
exit 0