3# From: @(#)rc 5.27 (Berkeley) 6/5/91 4 5# System startup script run by init on autoboot 6# or after single-user. 7# Output and error are redirected to console by init, 8# and the console is the controlling terminal. 9 10stty status '^T' 11 12# Set shell to ignore SIGINT (2), but not children; 13# shell catches SIGQUIT (3) and returns to single user after fsck. 14trap : 2 15trap : 3 # shouldn't be needed 16 17HOME=/; export HOME 18PATH=/sbin:/bin:/usr/sbin:/usr/bin 19export PATH 20 21if [ -e /fastboot ] 22then 23 echo Fast boot ... skipping disk checks 24elif [ $1x = autobootx ] 25then 26 echo Automatic reboot in progress... 27 fsck -p 28 case $? in 29 0) 30 ;; 31 2) 32 exit 1 33 ;; 34 4) 35 reboot 36 echo "reboot failed... help!" 37 exit 1 38 ;; 39 8) 40 echo "Automatic file system check failed... help!" 41 exit 1 42 ;; 43 12) 44 echo "Reboot interrupted" 45 exit 1 46 ;; 47 130) 48 # interrupt before catcher installed 49 exit 1 50 ;; 51 *) 52 echo "Unknown error in reboot" 53 exit 1 54 ;; 55 esac 56fi 57 58trap "echo 'Reboot interrupted'; exit 1" 3 59 60swapon -a 61 62umount -a >/dev/null 2>&1 63mount -a -t nonfs 64rm -f /fastboot # XXX (root now writeable) 65 66# If the machine runs wall CMOS clock (compatible with MSDOS), 67# activate following line by creating empty file /etc/wall_cmos_clock 68# If this file not exist, following line does nothing (assumed 69# the machine runs UTC CMOS clock). See adjkerntz(8) for details. 70adjkerntz -i 71
| 3# From: @(#)rc 5.27 (Berkeley) 6/5/91 4 5# System startup script run by init on autoboot 6# or after single-user. 7# Output and error are redirected to console by init, 8# and the console is the controlling terminal. 9 10stty status '^T' 11 12# Set shell to ignore SIGINT (2), but not children; 13# shell catches SIGQUIT (3) and returns to single user after fsck. 14trap : 2 15trap : 3 # shouldn't be needed 16 17HOME=/; export HOME 18PATH=/sbin:/bin:/usr/sbin:/usr/bin 19export PATH 20 21if [ -e /fastboot ] 22then 23 echo Fast boot ... skipping disk checks 24elif [ $1x = autobootx ] 25then 26 echo Automatic reboot in progress... 27 fsck -p 28 case $? in 29 0) 30 ;; 31 2) 32 exit 1 33 ;; 34 4) 35 reboot 36 echo "reboot failed... help!" 37 exit 1 38 ;; 39 8) 40 echo "Automatic file system check failed... help!" 41 exit 1 42 ;; 43 12) 44 echo "Reboot interrupted" 45 exit 1 46 ;; 47 130) 48 # interrupt before catcher installed 49 exit 1 50 ;; 51 *) 52 echo "Unknown error in reboot" 53 exit 1 54 ;; 55 esac 56fi 57 58trap "echo 'Reboot interrupted'; exit 1" 3 59 60swapon -a 61 62umount -a >/dev/null 2>&1 63mount -a -t nonfs 64rm -f /fastboot # XXX (root now writeable) 65 66# If the machine runs wall CMOS clock (compatible with MSDOS), 67# activate following line by creating empty file /etc/wall_cmos_clock 68# If this file not exist, following line does nothing (assumed 69# the machine runs UTC CMOS clock). See adjkerntz(8) for details. 70adjkerntz -i 71
|
72# set hostname, turn on network 73echo 'starting network' 74. /etc/netstart 75 76# clean up left-over files 77rm -f /etc/nologin 78rm -f /var/spool/lock/* 79rm -f /var/spool/uucp/.Temp/* 80# don't add .[a-z]* to rm, because of .adjkerntz file name 81(cd /var/run && { rm -rf -- *; cp /dev/null utmp; chmod 644 utmp; }) 82 83echo -n 'starting system logger' 84rm -f /dev/log 85syslogd 86 87# $timedflags is imported from /etc/netstart; 88# if $timedflags == NO, timed isn't run. 89if [ X${timedflags} != X"NO" ]; then 90 echo -n ', time daemon'; timed $timedflags 91fi 92echo '.' 93 94# /var/crash should be a directory or a symbolic link 95# to the crash directory if core dumps are to be saved. 96if [ -d /var/crash ]; then 97 echo checking for core dump... 98 savecore /var/crash 99fi 100 101# echo -n 'checking quotas:' 102#quotacheck -a 103# echo ' done.' 104#quotaon -a 105 106# build ps databases 107kvm_mkdb /386bsd 108dev_mkdb 109 110chmod 666 /dev/tty[pqrs]* 111 112# check the password temp/lock file 113if [ -f /etc/ptmp ] 114then 115 logger -s -p auth.err \ 116 'password file may be incorrect -- /etc/ptmp exists' 117fi 118 119# Recover elvis editor files. 120echo preserving editor files 121(cd /var/tmp && /usr/libexec/elvispreserve "-the system rebooted" elv* && 122 rm -f elvis[0-9a-f][0-9a-f][0-9a-f][0-9a-f]* \ 123 elvis_[0-9a-f][0-9a-f][0-9a-f][0-9a-f]*) 124 125# Recover vi editor files. 126virecovery=/var/tmp/vi.recover/recover.* 127if [ "$virecovery" != "/var/tmp/vi.recover/recover.*" ]; then 128 echo 'Recovering vi editor sessions' 129 for i in $virecovery; do 130 sendmail -t < $i 131 done 132fi 133 134echo clearing /tmp 135 136# prune quickly with one rm, then use find to clean up /tmp/[lq]* 137# (not needed with mfs /tmp, but doesn't hurt there...) 138(cd /tmp && rm -rf [a-km-pr-zA-Z]* && 139 find -d . ! -name . ! -name lost+found ! -name quotas -exec rm -rf -- {} \;) 140 141# echo 'turning on accounting'; accton /var/account/acct 142 143echo -n standard daemons: 144echo -n ' cron'; cron 145echo '.' 146 147echo -n starting network daemons: 148 149# Portmapper should always be run, to provide RPC services for inetd. 150if [ -x /usr/sbin/portmap ]; then 151 echo -n ' portmap'; portmap 152fi 153 154# $gated and $routedflags are imported from /etc/netstart. 155# If $gated == YES, gated is used; otherwise routed. 156# If $routedflags == NO, routed isn't run. 157if [ X${gated} = X"YES" -a -r /etc/gated.conf ]; then 158 echo -n ' gated'; gated $gatedflags 159elif [ X"${routedflags}" != X"NO" ]; then 160 echo -n ' routed'; routed $routedflags 161fi 162 163if [ X${name_server} = X"YES" -a -r /etc/named.boot ]; then 164 echo -n ' named'; named 165fi 166 167# $ntpdate and $xntpdflags are imported from /etc/netstart. 168# If $ntpdate != NO, run ntpdate $ntpdate to set the date correctly. 169# If $xntpdflags != NO, start xntpd. 170if [ X"${ntpdate}" != X"NO" ]; then 171 echo ' ntpdate'; ntpdate $ntpdate 172fi 173 174if [ X"${xntpdflags}" != X"NO" ]; then 175 if [ X"${tickadjflags}" != X"NO" ]; then 176 echo 'adjusting kernel for xntpd'; tickadj ${tickadjflags--A} 177 fi 178 echo 'starting xntpd'; xntpd ${xntpdflags} 179fi 180 181if [ X"${ntpdate}" != X"NO" -o X"${xntpdflags}" != X"NO" ]; then 182 echo -n 'starting more network daemons:' 183fi 184 185# $rwhod is imported from /etc/netstart; 186# if $rwhod is set to something other than NO, rwhod is run. 187if [ ${rwhod-NO} != "NO" ]; then 188 echo -n ' rwhod'; rwhod 189fi 190 191echo -n ' printer'; lpd 192 193if [ X${nfs_server} = X"YES" -a -r /etc/exports ]; then 194 echo -n ' mountd'; mountd 195 echo -n ' nfsd'; nfsd -u 0,0,4 -t 0,0 196 echo -n ' nfsiod'; nfsiod 4 197fi 198 199# $sendmail_flags is imported from /etc/netstart; 200# if $sendmail_flags is something other than NO, sendmail is run. 201if [ X"${sendmail_flags}" != X"NO" -a -r /etc/sendmail.cf ]; then 202 echo -n ' sendmail'; sendmail ${sendmail_flags} 203fi 204 205echo -n ' inetd'; inetd 206echo '.' 207 208mount -a -t nfs >/dev/null 2>&1 & # XXX shouldn't need background 209 210if [ -x /usr/libexec/xtend ]; then 211 echo -n ' xtend'; /usr/libexec/xtend 212fi 213 214# Make shared lib searching a little faster. Leave /usr/lib first if you 215# add your own entries or you may come to grief. 216if [ -x /sbin/ldconfig ]; then 217 _LDC=/usr/lib 218 if [ -d /usr/X11R6/lib ]; then _LDC="${_LDC} /usr/X11R6/lib" ; fi 219 if [ -d /usr/X386/lib ]; then _LDC="${_LDC} /usr/X386/lib" ; fi 220 if [ -d /usr/local/lib ]; then _LDC="${_LDC} /usr/local/lib" ; fi 221 if [ -d /usr/gnu/lib ]; then _LDC="${_LDC} /usr/gnu/lib" ; fi 222 echo 'setting ldconfig path:' ${_LDC} 223 ldconfig ${_LDC} 224fi 225 226sh /etc/rc.local 227 228date 229 230exit 0
| 78# set hostname, turn on network 79echo 'starting network' 80. /etc/netstart 81 82# clean up left-over files 83rm -f /etc/nologin 84rm -f /var/spool/lock/* 85rm -f /var/spool/uucp/.Temp/* 86# don't add .[a-z]* to rm, because of .adjkerntz file name 87(cd /var/run && { rm -rf -- *; cp /dev/null utmp; chmod 644 utmp; }) 88 89echo -n 'starting system logger' 90rm -f /dev/log 91syslogd 92 93# $timedflags is imported from /etc/netstart; 94# if $timedflags == NO, timed isn't run. 95if [ X${timedflags} != X"NO" ]; then 96 echo -n ', time daemon'; timed $timedflags 97fi 98echo '.' 99 100# /var/crash should be a directory or a symbolic link 101# to the crash directory if core dumps are to be saved. 102if [ -d /var/crash ]; then 103 echo checking for core dump... 104 savecore /var/crash 105fi 106 107# echo -n 'checking quotas:' 108#quotacheck -a 109# echo ' done.' 110#quotaon -a 111 112# build ps databases 113kvm_mkdb /386bsd 114dev_mkdb 115 116chmod 666 /dev/tty[pqrs]* 117 118# check the password temp/lock file 119if [ -f /etc/ptmp ] 120then 121 logger -s -p auth.err \ 122 'password file may be incorrect -- /etc/ptmp exists' 123fi 124 125# Recover elvis editor files. 126echo preserving editor files 127(cd /var/tmp && /usr/libexec/elvispreserve "-the system rebooted" elv* && 128 rm -f elvis[0-9a-f][0-9a-f][0-9a-f][0-9a-f]* \ 129 elvis_[0-9a-f][0-9a-f][0-9a-f][0-9a-f]*) 130 131# Recover vi editor files. 132virecovery=/var/tmp/vi.recover/recover.* 133if [ "$virecovery" != "/var/tmp/vi.recover/recover.*" ]; then 134 echo 'Recovering vi editor sessions' 135 for i in $virecovery; do 136 sendmail -t < $i 137 done 138fi 139 140echo clearing /tmp 141 142# prune quickly with one rm, then use find to clean up /tmp/[lq]* 143# (not needed with mfs /tmp, but doesn't hurt there...) 144(cd /tmp && rm -rf [a-km-pr-zA-Z]* && 145 find -d . ! -name . ! -name lost+found ! -name quotas -exec rm -rf -- {} \;) 146 147# echo 'turning on accounting'; accton /var/account/acct 148 149echo -n standard daemons: 150echo -n ' cron'; cron 151echo '.' 152 153echo -n starting network daemons: 154 155# Portmapper should always be run, to provide RPC services for inetd. 156if [ -x /usr/sbin/portmap ]; then 157 echo -n ' portmap'; portmap 158fi 159 160# $gated and $routedflags are imported from /etc/netstart. 161# If $gated == YES, gated is used; otherwise routed. 162# If $routedflags == NO, routed isn't run. 163if [ X${gated} = X"YES" -a -r /etc/gated.conf ]; then 164 echo -n ' gated'; gated $gatedflags 165elif [ X"${routedflags}" != X"NO" ]; then 166 echo -n ' routed'; routed $routedflags 167fi 168 169if [ X${name_server} = X"YES" -a -r /etc/named.boot ]; then 170 echo -n ' named'; named 171fi 172 173# $ntpdate and $xntpdflags are imported from /etc/netstart. 174# If $ntpdate != NO, run ntpdate $ntpdate to set the date correctly. 175# If $xntpdflags != NO, start xntpd. 176if [ X"${ntpdate}" != X"NO" ]; then 177 echo ' ntpdate'; ntpdate $ntpdate 178fi 179 180if [ X"${xntpdflags}" != X"NO" ]; then 181 if [ X"${tickadjflags}" != X"NO" ]; then 182 echo 'adjusting kernel for xntpd'; tickadj ${tickadjflags--A} 183 fi 184 echo 'starting xntpd'; xntpd ${xntpdflags} 185fi 186 187if [ X"${ntpdate}" != X"NO" -o X"${xntpdflags}" != X"NO" ]; then 188 echo -n 'starting more network daemons:' 189fi 190 191# $rwhod is imported from /etc/netstart; 192# if $rwhod is set to something other than NO, rwhod is run. 193if [ ${rwhod-NO} != "NO" ]; then 194 echo -n ' rwhod'; rwhod 195fi 196 197echo -n ' printer'; lpd 198 199if [ X${nfs_server} = X"YES" -a -r /etc/exports ]; then 200 echo -n ' mountd'; mountd 201 echo -n ' nfsd'; nfsd -u 0,0,4 -t 0,0 202 echo -n ' nfsiod'; nfsiod 4 203fi 204 205# $sendmail_flags is imported from /etc/netstart; 206# if $sendmail_flags is something other than NO, sendmail is run. 207if [ X"${sendmail_flags}" != X"NO" -a -r /etc/sendmail.cf ]; then 208 echo -n ' sendmail'; sendmail ${sendmail_flags} 209fi 210 211echo -n ' inetd'; inetd 212echo '.' 213 214mount -a -t nfs >/dev/null 2>&1 & # XXX shouldn't need background 215 216if [ -x /usr/libexec/xtend ]; then 217 echo -n ' xtend'; /usr/libexec/xtend 218fi 219 220# Make shared lib searching a little faster. Leave /usr/lib first if you 221# add your own entries or you may come to grief. 222if [ -x /sbin/ldconfig ]; then 223 _LDC=/usr/lib 224 if [ -d /usr/X11R6/lib ]; then _LDC="${_LDC} /usr/X11R6/lib" ; fi 225 if [ -d /usr/X386/lib ]; then _LDC="${_LDC} /usr/X386/lib" ; fi 226 if [ -d /usr/local/lib ]; then _LDC="${_LDC} /usr/local/lib" ; fi 227 if [ -d /usr/gnu/lib ]; then _LDC="${_LDC} /usr/gnu/lib" ; fi 228 echo 'setting ldconfig path:' ${_LDC} 229 ldconfig ${_LDC} 230fi 231 232sh /etc/rc.local 233 234date 235 236exit 0
|