rc revision 16391
1#!/bin/sh 2# $Id: rc,v 1.90 1996/05/19 22:30:26 ache 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 10# Note that almost all the user-configurable behavior is no longer in 11# this file, but rather in /etc/sysconfig. Please check this file 12# first before contemplating any changes here. 13 14stty status '^T' 15 16# Set shell to ignore SIGINT (2), but not children; 17# shell catches SIGQUIT (3) and returns to single user after fsck. 18trap : 2 19trap : 3 # shouldn't be needed 20 21HOME=/; export HOME 22PATH=/sbin:/bin:/usr/sbin:/usr/bin 23export PATH 24 25# Configure ccd devices. 26if [ -f /etc/ccd.conf ] 27then 28 ccdconfig -C 29fi 30 31swapon -a 32 33if [ $1x = autobootx ] 34then 35 echo Automatic reboot in progress... 36 fsck -p 37 case $? in 38 0) 39 ;; 40 2) 41 exit 1 42 ;; 43 4) 44 reboot 45 echo "reboot failed... help!" 46 exit 1 47 ;; 48 8) 49 echo "Automatic file system check failed... help!" 50 exit 1 51 ;; 52 12) 53 echo "Reboot interrupted" 54 exit 1 55 ;; 56 130) 57 # interrupt before catcher installed 58 exit 1 59 ;; 60 *) 61 echo "Unknown error in reboot" 62 exit 1 63 ;; 64 esac 65else 66 echo Skipping disk checks ... 67fi 68 69trap "echo 'Reboot interrupted'; exit 1" 3 70 71# root must be read/write both for NFS diskless and for VFS LKMs before 72# proceeding any further. 73mount -u -o rw / 74if [ $? != 0 ]; then 75 echo "Filesystem mount failed, startup aborted" 76 exit 1 77fi 78 79umount -a >/dev/null 2>&1 80 81mount -a -t nonfs 82if [ $? != 0 ]; then 83 echo "Filesystem mount failed, startup aborted" 84 exit 1 85fi 86 87adjkerntz -i 88 89# If there is a global system configuration file, suck it in. 90if [ -f /etc/sysconfig ]; then 91 . /etc/sysconfig 92fi 93 94# configure serial devices 95if [ -f /etc/rc.serial ]; then 96 . /etc/rc.serial 97fi 98 99# start up PC-card configuration 100if [ -f /etc/rc.pccard ]; then 101 . /etc/rc.pccard 102fi 103 104# start up the network 105if [ -f /etc/netstart ]; then 106 sh /etc/netstart 107fi 108 109mount -a -t nfs >/dev/null 2>&1 110 111# Whack the pty perms back into shape. 112chmod 666 /dev/tty[pqrs]* 113 114# clean up left-over files 115rm -f /etc/nologin 116rm -f /var/spool/lock/* 117rm -rf /var/spool/uucp/.Temp/* 118rm -f /dev/log 119(cd /var/run && { cp /dev/null utmp; chmod 644 utmp; }) 120 121echo clearing /tmp 122 123# prune quickly with one rm, then use find to clean up /tmp/[lq]* 124# (not needed with mfs /tmp, but doesn't hurt there...) 125(cd /tmp && rm -rf [a-km-pr-zA-Z]* && 126 find -d . ! -name . ! -name lost+found ! -name quotas -exec rm -rf -- {} \;) 127 128# enable dumpdev so that savecore can see it 129if [ "X${dumpdev}" != X"NO" ]; then 130 dumpon ${dumpdev} 131fi 132 133# /var/crash should be a directory or a symbolic link 134# to the crash directory if core dumps are to be saved. 135if [ "X${savecore}" = X"YES" -a -d /var/crash ]; then 136 echo -n checking for core dump... 137 savecore /var/crash 138fi 139 140# snapshot any kernel -c changes back to disk 141echo 'recording kernel -c changes' 142/sbin/dset -q 143 144# Check the quotas 145if [ "X${check_quotas}" = X"YES" ]; then 146 echo 'checking quotas:' 147 quotacheck -a 148 echo ' done.' 149 quotaon -a 150fi 151 152# start system logging and name service (named needs to start before syslogd 153# if you don't have a /etc/resolv.conf) 154# 155echo -n starting system daemons: 156 157echo ' syslogd.'; syslogd 158 159echo -n starting network daemons: 160 161# $namedflags is imported from /etc/sysconfig 162if [ "X${namedflags}" != "XNO" ]; then 163 echo -n ' named'; named $namedflags 164fi 165 166# $ntpdate and $xntpdflags are imported from /etc/sysconfig. 167# If $ntpdate != NO, run ntpdate $ntpdate to set the date correctly. 168# If $xntpdflags != NO, start xntpd. 169if [ "X${ntpdate}" != X"NO" -o "X${xntpdflags}" != X"NO" ]; then 170 if [ "X${tickadjflags}" != X"NO" ]; then 171 echo -n ' tickadj'; tickadj ${tickadjflags--Aq} 172 fi 173 174 if [ "X${ntpdate}" != X"NO" ]; then 175 echo -n ' ntpdate'; ntpdate ${ntpdate} >/dev/null 2>&1 176 fi 177 178 if [ "X${xntpdflags}" != X"NO" ]; then 179 echo -n ' xntpd'; xntpd ${xntpdflags} 180 fi 181fi 182 183# $timedflags is imported from /etc/sysconfig; 184# if $timedflags == NO, timed isn't run. 185if [ "X${timedflags}" != X"NO" ]; then 186 echo -n ' timed'; timed $timedflags 187fi 188 189# Portmapper should always be run, to provide RPC services for inetd. 190if [ -x /usr/sbin/portmap ]; then 191 echo -n ' portmap'; portmap 192fi 193 194# Start ypserv if we're an NIS server. 195# Run yppasswdd only on the NIS master server 196if [ "X${nis_serverflags}" != X"NO" ]; then 197 echo -n ' ypserv'; ypserv ${nis_serverflags} 198 199 if [ "X${yppasswddflags}" != X"NO" ]; then 200 echo -n ' yppasswdd'; rpc.yppasswdd ${yppasswddflags} 201 fi 202fi 203 204# Start ypbind if we're an NIS client 205if [ "X${nis_clientflags}" != X"NO" ]; then 206 echo -n ' ypbind'; ypbind ${nis_clientflags} 207 if [ "X${nis_ypsetflags}" != X"NO" ]; then 208 echo -n ' ypset'; ypset ${nis_ypsetflags} 209 fi 210fi 211 212# $rwhod is imported from /etc/sysconfig; 213# if $rwhod is set to YES, rwhod is run. 214if [ "X${rwhod}" = X"YES" ]; then 215 echo -n ' rwhod'; rwhod 216fi 217 218if [ "X${nfs_server}" = X"YES" -a -r /etc/exports ]; then 219 echo -n ' mountd' 220 if [ "X${weak_mountd_authentication}" = X"YES" ]; then 221 mountd -n 222 else 223 mountd 224 fi 225 echo -n ' nfsd'; nfsd -u -t 4 226fi 227 228if [ "X${nfs_client}" = X"YES" ]; then 229 echo -n ' nfsiod'; nfsiod -n 4 230fi 231 232if [ "X${amdflags}" != X"NO" ]; then 233 echo -n ' amd' 234 amd ${amdflags} > /var/run/amd.pid 235fi 236 237# Kerberos runs ONLY on the Kerberos server machine 238if [ "X${kerberos_server}" = X"YES" ]; then 239 echo -n ' kerberos'; kerberos >> /var/log/kerberos.log & 240 echo -n ' kadmind'; \ 241 (sleep 20; kadmind -n >/dev/null 2>&1 &) & 242fi 243 244# IP multicast routing daemon 245if [ "X${mrouted}" != X"NO" -a -x /usr/sbin/mrouted ]; then 246 echo -n ' mrouted'; mrouted ${mrouted} 247fi 248 249echo -n ' inetd'; inetd 250echo '.' 251 252# build ps databases 253kvm_mkdb 254dev_mkdb 255 256# check the password temp/lock file 257if [ -f /etc/ptmp ] 258then 259 logger -s -p auth.err \ 260 "password file may be incorrect -- /etc/ptmp exists" 261fi 262 263# Recover vi editor files. 264virecovery=`echo /var/tmp/vi.recover/recover.*` 265if [ "$virecovery" != '/var/tmp/vi.recover/recover.*' ]; then 266 echo 'Recovering vi editor sessions' 267 for i in $virecovery; do 268 sendmail -t < $i 269 done 270fi 271 272if [ "X${accounting}" = X"YES" -a -d /var/account ]; then 273 echo 'turning on accounting' 274 if [ ! -e /var/account/acct ]; then 275 touch /var/account/acct 276 fi 277 accton /var/account/acct 278fi 279 280# Now start up miscellaneous daemons that don't belong anywhere else 281# 282echo -n standard daemons: 283echo -n ' cron'; cron 284 285if [ "X${lpd}" != X"NO" -a -x /usr/sbin/lpd ]; then 286 echo -n ' printer'; lpd 287fi 288 289# $sendmail_flags is imported from /etc/sysconfig; 290# if $sendmail_flags is something other than NO, sendmail is run. 291if [ "X${sendmail_flags}" != X"NO" -a -r /etc/sendmail.cf ]; then 292 echo -n ' sendmail'; /usr/sbin/sendmail ${sendmail_flags} 293fi 294 295echo '.' 296 297# Make shared lib searching a little faster. Leave /usr/lib first if you 298# add your own entries or you may come to grief. 299if [ -x /sbin/ldconfig ]; then 300 _LDC=/usr/lib 301 if [ -d /usr/X11R6/lib ]; then _LDC="${_LDC} /usr/X11R6/lib" ; fi 302 if [ -d /usr/X386/lib ]; then _LDC="${_LDC} /usr/X386/lib" ; fi 303 if [ -d /usr/local/lib ]; then _LDC="${_LDC} /usr/local/lib" ; fi 304 echo 'setting ldconfig path:' ${_LDC} 305 ldconfig ${_LDC} 306fi 307 308# configure implementation specific stuff 309arch=`uname -m` 310if [ -f /etc/rc.${arch} ]; then 311 . /etc/rc.${arch} 312fi 313 314# for each valid dir in $local_startup, search for init scripts matching *.sh 315if [ "X${local_startup}" != X"NO" ]; then 316 echo -n 'Local package startup:' 317 for dir in ${local_startup}; do 318 [ -d ${dir} ] && for script in ${dir}/*.sh; do 319 [ -x ${script} ] && ${script} start 320 done 321 done 322 echo . 323fi 324 325# Do traditional (but rather obsolete) rc.local file if it exists. 326[ -f /etc/rc.local ] && sh /etc/rc.local 327 328date 329exit 0 330