cleartmp (179944) | cleartmp (197947) |
---|---|
1#!/bin/sh 2# | 1#!/bin/sh 2# |
3# $FreeBSD: head/etc/rc.d/cleartmp 179944 2008-06-23 04:42:58Z mtm $ | 3# $FreeBSD: head/etc/rc.d/cleartmp 197947 2009-10-10 22:17:03Z dougb $ |
4# 5 6# PROVIDE: cleartmp 7# REQUIRE: mountcritremote tmp 8# BEFORE: DAEMON 9 10. /etc/rc.subr 11 --- 8 unchanged lines hidden (view full) --- 20 # Make /tmp location variable for easier debugging. 21 local tmp="/tmp" 22 23 # X related directories to create in /tmp. 24 local x11_socket_dirs="${tmp}/.X11-unix ${tmp}/.XIM-unix \ 25 ${tmp}/.ICE-unix ${tmp}/.font-unix" 26 27 if checkyesno ${rcvar1}; then | 4# 5 6# PROVIDE: cleartmp 7# REQUIRE: mountcritremote tmp 8# BEFORE: DAEMON 9 10. /etc/rc.subr 11 --- 8 unchanged lines hidden (view full) --- 20 # Make /tmp location variable for easier debugging. 21 local tmp="/tmp" 22 23 # X related directories to create in /tmp. 24 local x11_socket_dirs="${tmp}/.X11-unix ${tmp}/.XIM-unix \ 25 ${tmp}/.ICE-unix ${tmp}/.font-unix" 26 27 if checkyesno ${rcvar1}; then |
28 [ -z "${rc_quiet}" ] && echo "Clearing ${tmp}." | 28 check_startmsgs && echo "Clearing ${tmp}." |
29 30 # This is not needed for mfs, but doesn't hurt anything. 31 # Things to note: 32 # + The dot in ${tmp}/. is important. 33 # + Put -prune before -exec so find never descends 34 # into a directory that was already passed to rm -rf. 35 # + "--" in rm arguments isn't strictly necessary, but 36 # it can prevent foot-shooting in future. 37 # + /tmp/lost+found is preserved, but its contents are removed. 38 # + lost+found and quota.* in subdirectories are removed. 39 find -x ${tmp}/. ! -name . \ 40 ! \( -name lost+found -type d -user root \) \ 41 ! \( \( -name quota.user -or -name quota.group \) \ 42 -type f -user root \) \ 43 -prune -exec rm -rf -- {} + 44 elif checkyesno clear_tmp_X; then 45 # Remove X lock files, since they will prevent you from 46 # restarting X. Remove other X related directories. | 29 30 # This is not needed for mfs, but doesn't hurt anything. 31 # Things to note: 32 # + The dot in ${tmp}/. is important. 33 # + Put -prune before -exec so find never descends 34 # into a directory that was already passed to rm -rf. 35 # + "--" in rm arguments isn't strictly necessary, but 36 # it can prevent foot-shooting in future. 37 # + /tmp/lost+found is preserved, but its contents are removed. 38 # + lost+found and quota.* in subdirectories are removed. 39 find -x ${tmp}/. ! -name . \ 40 ! \( -name lost+found -type d -user root \) \ 41 ! \( \( -name quota.user -or -name quota.group \) \ 42 -type f -user root \) \ 43 -prune -exec rm -rf -- {} + 44 elif checkyesno clear_tmp_X; then 45 # Remove X lock files, since they will prevent you from 46 # restarting X. Remove other X related directories. |
47 [ -z "${rc_quiet}" ] && echo "Clearing ${tmp} (X related)." | 47 check_startmsgs && echo "Clearing ${tmp} (X related)." |
48 rm -rf ${tmp}/.X[0-9]-lock ${x11_socket_dirs} 49 fi 50 if checkyesno clear_tmp_X; then 51 # Create X related directories with proper permissions. 52 mkdir -m 1777 ${x11_socket_dirs} 53 fi 54} 55 56load_rc_config $name 57run_rc_command "$1" | 48 rm -rf ${tmp}/.X[0-9]-lock ${x11_socket_dirs} 49 fi 50 if checkyesno clear_tmp_X; then 51 # Create X related directories with proper permissions. 52 mkdir -m 1777 ${x11_socket_dirs} 53 fi 54} 55 56load_rc_config $name 57run_rc_command "$1" |