rc revision 1.22
1# @(#)rc 5.27 (Berkeley) 6/5/91 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 [ -e /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 64echo 'runtime link editor directory cache' 65rm -f /var/run/ld.so.hints 66ldconfig 67 68# set hostname, turn on network 69echo 'starting network' 70. /etc/netstart 71 72mount -a -t nfs >/dev/null 2>&1 & # XXX shouldn't need background 73 74# clean up left-over files 75rm -f /etc/nologin 76rm -f /var/spool/uucp/LCK.* 77rm -f /var/spool/uucp/STST/* 78(cd /var/run && { rm -rf -- *; cp /dev/null utmp; chmod 644 utmp; }) 79 80echo -n 'starting system logger' 81rm -f /dev/log 82syslogd 83 84# $timed_flags is imported from /etc/netstart; 85# if $timed_flags == NO, timed isn't run. 86if [ "X${timed_flags}" != X"NO" ]; then 87 echo -n ', time daemon'; timed $timed_flags 88fi 89echo '.' 90 91# /var/crash should be a directory or a symbolic link 92# to the crash directory if core dumps are to be saved. 93if [ -d /var/crash ]; then 94 echo checking for core dump... 95 savecore /var/crash 96fi 97 98# echo -n 'checking quotas:' 99#quotacheck -a 100# echo ' done.' 101#quotaon -a 102 103# build ps databases 104echo 'building databases...' 105kvm_mkdb /netbsd 106dev_mkdb 107 108chmod 666 /dev/tty[pqrs]* 109 110# check the password temp/lock file 111if [ -f /etc/ptmp ] 112then 113 logger -s -p auth.err \ 114 'password file may be incorrect -- /etc/ptmp exists' 115fi 116 117echo preserving editor files 118(cd /var/tmp && /usr/libexec/elvispreserve "-the system rebooted" elvis* && 119 rm -f elvis[0-9a-f][0-9a-f][0-9a-f][0-9a-f]* \ 120 elvis_[0-9a-f][0-9a-f][0-9a-f][0-9a-f]*) 121 122echo clearing /tmp 123 124# prune quickly with one rm, then use find to clean up /tmp/[lq]* 125# (not needed with mfs /tmp, but doesn't hurt there...) 126(cd /tmp && rm -rf [a-km-pr-zA-Z]* && 127 find . ! -name . ! -name lost+found ! -name quotas \ 128 -exec rm -rf -- {} \; -type d -prune) 129 130#echo 'turning on accounting'; accton /var/account/acct 131 132echo -n standard daemons: 133echo -n ' update'; update 134echo -n ' crond'; /usr/libexec/crond 135echo '.' 136 137echo -n starting network daemons: 138 139# $gated and $routed_flags are imported from /etc/netstart. 140# If $gated == YES, gated is used; otherwise routed. 141# If $routed_flags == NO, routed isn't run. 142if [ X${gated} = X"YES" -a -r /etc/gated.conf ]; then 143 echo -n ' gated'; gated $gated_flags 144elif [ "X${routed_flags}" != X"NO" ]; then 145 echo -n ' routed'; routed $routed_flags 146fi 147 148# $name_server is imported from /etc/netstart; 149# if $name_server == YES, named is run. 150if [ X${name_server} = X"YES" -a -r /etc/named.boot ]; then 151 echo -n ' named'; named 152fi 153 154# $rwhod is imported from /etc/netstart; 155# if $rwhod == YES, rwhod is run. 156if [ X${rwhod} = X"YES" ]; then 157 echo -n ' rwhod'; rwhod 158fi 159 160echo -n ' printer'; lpd 161 162echo -n ' portmap'; portmap 163 164# $nfs_server is imported from /etc/netstart; 165# if $nfs_server == YES, the machine is setup for being an nfs server 166if [ X${nfs_server} = X"YES" -a -r /etc/exports ]; then 167 rm -f /var/db/mountdtab 168 echo -n ' mountd'; mountd 169 echo -n ' nfsd'; nfsd -u 0,0,4 -t 0,0 170fi 171 172# $nfs_client is imported from /etc/netstart; 173# if $nfs_client == YES, the machine is setup for being an nfs client 174if [ X${nfs_client} = X"YES" ]; then 175 echo -n ' nfsiod'; nfsiod 4 176fi 177 178# $sendmail_flags is imported from /etc/netstart; 179# If $sendmail_flags == NO, routed isn't run. 180if [ "X${sendmail_flags}" != X"NO" ]; then 181 echo -n ' sendmail'; sendmail ${sendmail_flags} 182fi 183 184echo -n ' inetd'; inetd 185echo '.' 186 187sh /etc/rc.local 188 189date 190 191exit 0 192