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