1 |
#!/bin/bash |
#!/bin/sh |
2 |
# $Header: /home/cvsd/magellan-cvs/magellan-src/magellan-initscripts/etc/rc.d/init.d/cleanfs,v 1.6 2005-07-03 21:29:42 niro Exp $ |
# $Header: /home/cvsd/magellan-cvs/magellan-src/busybox-initscripts/rc/cleanfs,v 1.2 2008-06-10 22:23:30 niro Exp $ |
3 |
|
|
4 |
#%rlevels: 7:s |
#%rlevels: 7:s |
5 |
#%start: 50 |
#%start: 50 |
10 |
#%before: |
#%before: |
11 |
#%after: |
#%after: |
12 |
|
|
13 |
source /etc/sysconfig/rc |
source /etc/conf.d/rc |
14 |
source $rc_functions |
source ${rc_functions} |
15 |
|
|
16 |
for dir in /tmp /var/run /var/lock |
case "$1" in |
17 |
do |
start) |
18 |
echo -e ${COLOREDSTAR}"Removing tmp files in ${dir}/* ..." |
for dir in /tmp /run /var/lock |
19 |
for file in $(find ${dir} -type f) |
do |
20 |
do |
[ -d ${dir} ] || continue |
21 |
[[ $(basename ${file}) = .keep ]] && continue |
rc_print "Removing tmp files in ${dir}/ ..." |
22 |
rm -f ${file} |
for file in $(find ${dir} -type f) |
23 |
done |
do |
24 |
evaluate_retval |
[[ $(basename ${file}) = .keep ]] && continue |
25 |
done |
rm -f ${file} |
26 |
|
done |
27 |
echo -e ${COLOREDSTAR}"Creating new /var/run/utmp ..." |
for subdir in $(find ${dir} -mindepth 1 -type d) |
28 |
touch /var/run/utmp && chmod 644 /var/run/utmp |
do |
29 |
evaluate_retval |
[[ -f ${subdir}/.keep ]] && continue |
30 |
|
rm -r ${subdir} |
31 |
echo -e ${COLOREDSTAR}"Creating new /var/run/wtmp ..." |
done |
32 |
touch /var/log/wtmp && chmod 644 /var/log/wtmp |
evaluate_retval |
33 |
evaluate_retval |
done |
34 |
|
|
35 |
echo -e ${COLOREDSTAR}"Removing possible /etc/nologin /fastboot and /forcefsck ..." |
rc_print "Creating new /run/utmp ..." |
36 |
rm -f /etc/nologin /fastboot /forcefsck |
touch /run/utmp && chmod 644 /run/utmp |
37 |
evaluate_retval |
evaluate_retval |
38 |
|
|
39 |
update_svcstatus $1 |
rc_print "Creating new /var/log/wtmp ..." |
40 |
splash svc_started "$(basename $0)" 0 |
touch /var/log/wtmp && chmod 644 /var/log/wtmp |
41 |
|
evaluate_retval |
42 |
|
|
43 |
|
rc_print "Removing possible /etc/nologin /fastboot and /forcefsck ..." |
44 |
|
rm -f /etc/nologin /fastboot /forcefsck |
45 |
|
evaluate_retval |
46 |
|
|
47 |
|
update_svcstatus $1 |
48 |
|
splash svc_started "$(basename $0)" 0 |
49 |
|
;; |
50 |
|
|
51 |
|
*) |
52 |
|
rc_echo "Usage: $0 {start}" |
53 |
|
exit 1 |
54 |
|
;; |
55 |
|
esac |