cleartmp revision 1.8
11.1Slukem#!/bin/sh 21.1Slukem# 31.8Selad# $NetBSD: cleartmp,v 1.8 2007/02/04 08:19:26 elad Exp $ 41.1Slukem# 51.1Slukem 61.1Slukem# PROVIDE: cleartmp 71.1Slukem# REQUIRE: mountall 81.4Sthorpej# BEFORE: DAEMON 91.1Slukem 101.5Smycroft$_rc_subr_loaded . /etc/rc.subr 111.1Slukem 121.1Slukemname="cleartmp" 131.3Slukemrcvar="clear_tmp" 141.1Slukemstart_cmd="cleartmp_start" 151.1Slukemstop_cmd=":" 161.1Slukem 171.1Slukemcleartmp_start() 181.1Slukem{ 191.8Selad echo "Clearing temporary files." 201.1Slukem # 211.1Slukem # Prune quickly with one rm, then use find to clean up 221.7Selad # /tmp/[lq]* (this is not needed with mfs /tmp, but 231.1Slukem # doesn't hurt anything). 241.1Slukem # 251.8Selad if [ \( X"${per_user_tmp}" = X"YES" \) -a \( -d ${per_user_tmp_dir} \) ]; then 261.8Selad tmp_dir=${per_user_tmp_dir} 271.8Selad else 281.8Selad tmp_dir="/tmp" 291.8Selad fi 301.8Selad 311.8Selad (cd ${tmp_dir} && rm -rf [a-km-pr-zA-Z]* && 321.1Slukem find -x . ! -name . ! -name lost+found ! -name quota.user \ 331.7Selad ! -name quota.group -exec rm -rf -- {} \; -type d -prune) 341.1Slukem} 351.1Slukem 361.2Slukemload_rc_config $name 371.1Slukemrun_rc_command "$1" 38