summaryrefslogtreecommitdiffstats
path: root/etc/rc.maint
blob: 5ae76c571f21277028f6eacb782c51e058758f90 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#!/bin/sh
#	$Id: rc.maint,v 1.2 1995/03/24 00:16:25 jkh Exp $
#	From: @(#)rc	5.27 (Berkeley) 6/5/91

# Various maintainance tasks to be done as the system is coming up

# /var/crash should be a directory or a symbolic link
# to the crash directory if core dumps are to be saved.
if [ "X${savecore}" = X"YES" -a -d /var/crash ]; then
	echo; echo -n checking for core dump...
	savecore /var/crash
	echo done.
fi

# clean up left-over files
rm -f /etc/nologin
rm -f /var/spool/lock/*
rm -f /var/spool/uucp/.Temp/*
(cd /var/run && { rm -rf -- *; cp /dev/null utmp; chmod 644 utmp; })

# Check the quotas
if [ "X${check_quotas}" = X"YES" ]; then
	echo 'checking quotas:'
	quotacheck -a
	echo ' done.'
	quotaon -a
fi

# build ps databases
kvm_mkdb 
dev_mkdb

# snapshot any kernel -c changes back to disk
echo 'check for kernel -c changes'
/sbin/dset -q

# Whack the pty perms back into shape.
chmod 666 /dev/tty[pqrs]*

# check the password temp/lock file
if [ -f /etc/ptmp ]
then
	logger -s -p auth.err \
	"password file may be incorrect -- /etc/ptmp exists"
fi

# Recover vi editor files.
virecovery=/var/tmp/vi.recover/recover.*
if [ "$virecovery" != "/var/tmp/vi.recover/recover.*" ]; then
	echo 'Recovering vi editor sessions'
	for i in $virecovery; do
		sendmail -t < $i
	done
fi

echo clearing /tmp

# prune quickly with one rm, then use find to clean up /tmp/[lq]*
# (not needed with mfs /tmp, but doesn't hurt there...)
(cd /tmp && rm -rf [a-km-pr-zA-Z]* &&
    find -d . ! -name . ! -name lost+found ! -name quotas -exec rm -rf -- {} \;)

if [ "X${accounting}" = X"YES" -a -d /var/account ]; then
	echo 'turning on accounting';	accton /var/account/acct
fi
OpenPOWER on IntegriCloud