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