1# @(#)rc 8.1 (Berkeley) 06/10/93 2 3# System startup script run by init on autoboot 4# or after single-user. 5# Output and error are redirected to console by init, 6# and the console is the controlling terminal. 7 8stty status '^T' 9 10# Set shell to ignore SIGINT (2), but not children; 11# shell catches SIGQUIT (3) and returns to single user after fsck. 12trap : 2 13trap : 3 # shouldn't be needed 14 15HOME=/; export HOME 16PATH=/sbin:/bin:/usr/sbin:/usr/bin 17export PATH 18 19if [ -r /fastboot ] 20then 21 echo Fast boot ... skipping disk checks 22elif [ $1x = autobootx ] 23then 24 echo Automatic reboot in progress... 25 fsck -p 26 case $? in 27 0) 28 ;; 29 2) 30 exit 1 31 ;; 32 4) 33 reboot 34 echo "reboot failed... help!" 35 exit 1 36 ;; 37 8) 38 echo "Automatic file system check failed... help!" 39 exit 1 40 ;; 41 12) 42 echo "Reboot interrupted" 43 exit 1 44 ;; 45 130) 46 # interrupt before catcher installed 47 exit 1 48 ;; 49 *) 50 echo "Unknown error in reboot" 51 exit 1 52 ;; 53 esac 54fi 55 56trap "echo 'Reboot interrupted'; exit 1" 3 57 58swapon -a 59 60umount -a >/dev/null 2>&1 61mount -a -t nonfs 62rm -f /fastboot # XXX (root now writeable) 63 64# set hostname, turn on network 65echo 'starting network' 66. /etc/netstart 67 68mount -a -t nfs >/dev/null 2>&1 & # XXX shouldn't need background 69 70# clean up left-over files 71rm -f /etc/nologin 72rm -f /var/spool/uucp/LCK.* 73rm -f /var/spool/uucp/STST/* 74(cd /var/run && { rm -rf -- *; install -c -m 664 -g utmp /dev/null utmp; }) 75 76echo -n 'starting system logger' 77rm -f /dev/log 78syslogd 79 80# $timedflags is imported from /etc/netstart; 81# if $timedflags == NO, timed isn't run. 82if [ X${timedflags} != X"NO" ]; then 83 echo -n ', time daemon'; timed $timedflags 84fi 85echo '.' 86 87# /var/crash should be a directory or a symbolic link 88# to the crash directory if core dumps are to be saved. 89if [ -d /var/crash ]; then 90 echo checking for core dump... 91 savecore /var/crash 92fi 93 94 echo -n 'checking quotas:' 95quotacheck -a 96 echo ' done.' 97quotaon -a 98 99# build ps databases 100kvm_mkdb 101dev_mkdb 102 103chmod 666 /dev/tty[pqrs]* 104 105# check the password temp/lock file 106if [ -f /etc/ptmp ] 107then 108 logger -s -p auth.err \ 109 'password file may be incorrect -- /etc/ptmp exists' 110fi 111 112echo preserving editor files 113(cd /var/tmp && /usr/libexec/ex3.7preserve -a && 114 rm -f Ex[0-9][0-9][0-9][0-9][0-9] Rx[0-9][0-9][0-9][0-9][0-9]) 115 116echo clearing /tmp 117 118# Prune quickly with one rm, then use find to clean up /tmp/[lq]* (this 119# is not needed with mfs /tmp, but doesn't hurt anything). 120(cd /tmp && rm -rf [a-km-pr-zA-Z]* && 121 find . ! -name . ! -name lost+found ! -name quotas -type d -prune \ 122 -exec rm -rf -- {} \;) 123 124echo 'turning on accounting'; accton /var/account/acct 125 126echo -n standard daemons: 127echo -n ' update'; update 128echo -n ' cron'; cron 129echo '.' 130 131echo -n starting network daemons: 132 133# $gated and $routedflags are imported from /etc/netstart. 134# If $gated == YES, gated is used; otherwise routed. 135# If $routedflags == NO, routed isn't run. 136if [ X${gated} = X"YES" -a -r /etc/gated.conf ]; then 137 echo -n ' gated'; gated $gatedflags 138elif [ X${routedflags} != X"NO" ]; then 139 echo -n ' routed'; routed $routedflags 140fi 141 142echo -n ' named'; named 143 144# $rwhod is imported from /etc/netstart; 145# if $rwhod is set to something other than NO, rwhod is run. 146if [ ${rwhod-NO} != "NO" ]; then 147 echo -n ' rwhod'; rwhod 148fi 149 150echo -n ' printer'; lpd 151 152echo -n ' portmap'; portmap 153echo -n ' mountd'; mountd 154echo -n ' nfsd'; nfsd -u -t 6 155echo -n ' nfsiod'; nfsiod 4 156 157echo -n ' sendmail'; sendmail -bd -q30m 158echo -n ' inetd'; inetd 159echo -n ' amd'; 160 cd /; amd -l /var/log/amd -r -a /amd -p > /var/run/amd.pid \ 161 /home /etc/amd-home \ 162 /n /etc/amd-n \ 163 & 164 165echo '.' 166 167sh /etc/rc.local 168 169date 170exit 0 171