rc revision 16588
1#!/bin/sh 2# $Id: rc,v 1.91 1996/06/15 17:04:48 jkh 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 121# 122# Clearing /tmp at boot-time is essentially stupid, but seems to have 123# a long tradition. It doesn't help in any way for long-living systems, 124# and it might accidentally clobber files you would rather like to have 125# preserved after a crash (if not using mfs /tmp anyway). 126# 127# See also the commented out example of another cleanup policy in 128# /etc/daily. 129# 130echo clearing /tmp 131 132# prune quickly with one rm, then use find to clean up /tmp/[lq]* 133# (not needed with mfs /tmp, but doesn't hurt there...) 134(cd /tmp && rm -rf [a-km-pr-zA-Z]* && 135 find -d . ! -name . ! -name lost+found ! -name quotas -exec rm -rf -- {} \;) 136 137# The above is even more stupid since it prevents you from restarting 138# X11 after a system crash. If you disable the above, make sure to 139# uncomment the line below. 140# 141# clean up leftover X lock files and local connection sockets 142#rm -f /tmp/.X*-lock /tmp/.X11-unix/* 143 144 145# enable dumpdev so that savecore can see it 146if [ "X${dumpdev}" != X"NO" ]; then 147 dumpon ${dumpdev} 148fi 149 150# /var/crash should be a directory or a symbolic link 151# to the crash directory if core dumps are to be saved. 152if [ "X${savecore}" = X"YES" -a -d /var/crash ]; then 153 echo -n checking for core dump... 154 savecore /var/crash 155fi 156 157# snapshot any kernel -c changes back to disk 158echo 'recording kernel -c changes' 159/sbin/dset -q 160 161# Check the quotas 162if [ "X${check_quotas}" = X"YES" ]; then 163 echo 'checking quotas:' 164 quotacheck -a 165 echo ' done.' 166 quotaon -a 167fi 168 169# start system logging and name service (named needs to start before syslogd 170# if you don't have a /etc/resolv.conf) 171# 172echo -n starting system daemons: 173 174echo ' syslogd.'; syslogd 175 176echo -n starting network daemons: 177 178# $namedflags is imported from /etc/sysconfig 179if [ "X${namedflags}" != "XNO" ]; then 180 echo -n ' named'; named $namedflags 181fi 182 183# $ntpdate and $xntpdflags are imported from /etc/sysconfig. 184# If $ntpdate != NO, run ntpdate $ntpdate to set the date correctly. 185# If $xntpdflags != NO, start xntpd. 186if [ "X${ntpdate}" != X"NO" -o "X${xntpdflags}" != X"NO" ]; then 187 if [ "X${tickadjflags}" != X"NO" ]; then 188 echo -n ' tickadj'; tickadj ${tickadjflags--Aq} 189 fi 190 191 if [ "X${ntpdate}" != X"NO" ]; then 192 echo -n ' ntpdate'; ntpdate ${ntpdate} >/dev/null 2>&1 193 fi 194 195 if [ "X${xntpdflags}" != X"NO" ]; then 196 echo -n ' xntpd'; xntpd ${xntpdflags} 197 fi 198fi 199 200# $timedflags is imported from /etc/sysconfig; 201# if $timedflags == NO, timed isn't run. 202if [ "X${timedflags}" != X"NO" ]; then 203 echo -n ' timed'; timed $timedflags 204fi 205 206# Portmapper should always be run, to provide RPC services for inetd. 207if [ -x /usr/sbin/portmap ]; then 208 echo -n ' portmap'; portmap 209fi 210 211# Start ypserv if we're an NIS server. 212# Run yppasswdd only on the NIS master server 213if [ "X${nis_serverflags}" != X"NO" ]; then 214 echo -n ' ypserv'; ypserv ${nis_serverflags} 215 216 if [ "X${yppasswddflags}" != X"NO" ]; then 217 echo -n ' yppasswdd'; rpc.yppasswdd ${yppasswddflags} 218 fi 219fi 220 221# Start ypbind if we're an NIS client 222if [ "X${nis_clientflags}" != X"NO" ]; then 223 echo -n ' ypbind'; ypbind ${nis_clientflags} 224 if [ "X${nis_ypsetflags}" != X"NO" ]; then 225 echo -n ' ypset'; ypset ${nis_ypsetflags} 226 fi 227fi 228 229# $rwhod is imported from /etc/sysconfig; 230# if $rwhod is set to YES, rwhod is run. 231if [ "X${rwhod}" = X"YES" ]; then 232 echo -n ' rwhod'; rwhod 233fi 234 235if [ "X${nfs_server}" = X"YES" -a -r /etc/exports ]; then 236 echo -n ' mountd' 237 if [ "X${weak_mountd_authentication}" = X"YES" ]; then 238 mountd -n 239 else 240 mountd 241 fi 242 echo -n ' nfsd'; nfsd -u -t 4 243fi 244 245if [ "X${nfs_client}" = X"YES" ]; then 246 echo -n ' nfsiod'; nfsiod -n 4 247fi 248 249if [ "X${amdflags}" != X"NO" ]; then 250 echo -n ' amd' 251 amd ${amdflags} > /var/run/amd.pid 252fi 253 254# Kerberos runs ONLY on the Kerberos server machine 255if [ "X${kerberos_server}" = X"YES" ]; then 256 echo -n ' kerberos'; kerberos >> /var/log/kerberos.log & 257 echo -n ' kadmind'; \ 258 (sleep 20; kadmind -n >/dev/null 2>&1 &) & 259fi 260 261# IP multicast routing daemon 262if [ "X${mrouted}" != X"NO" -a -x /usr/sbin/mrouted ]; then 263 echo -n ' mrouted'; mrouted ${mrouted} 264fi 265 266echo -n ' inetd'; inetd 267echo '.' 268 269# build ps databases 270kvm_mkdb 271dev_mkdb 272 273# check the password temp/lock file 274if [ -f /etc/ptmp ] 275then 276 logger -s -p auth.err \ 277 "password file may be incorrect -- /etc/ptmp exists" 278fi 279 280# Recover vi editor files. 281virecovery=`echo /var/tmp/vi.recover/recover.*` 282if [ "$virecovery" != '/var/tmp/vi.recover/recover.*' ]; then 283 echo 'Recovering vi editor sessions' 284 for i in $virecovery; do 285 sendmail -t < $i 286 done 287fi 288 289if [ "X${accounting}" = X"YES" -a -d /var/account ]; then 290 echo 'turning on accounting' 291 if [ ! -e /var/account/acct ]; then 292 touch /var/account/acct 293 fi 294 accton /var/account/acct 295fi 296 297# Now start up miscellaneous daemons that don't belong anywhere else 298# 299echo -n standard daemons: 300echo -n ' cron'; cron 301 302if [ "X${lpd}" != X"NO" -a -x /usr/sbin/lpd ]; then 303 echo -n ' printer'; lpd 304fi 305 306# $sendmail_flags is imported from /etc/sysconfig; 307# if $sendmail_flags is something other than NO, sendmail is run. 308if [ "X${sendmail_flags}" != X"NO" -a -r /etc/sendmail.cf ]; then 309 echo -n ' sendmail'; /usr/sbin/sendmail ${sendmail_flags} 310fi 311 312echo '.' 313 314# Make shared lib searching a little faster. Leave /usr/lib first if you 315# add your own entries or you may come to grief. 316if [ -x /sbin/ldconfig ]; then 317 _LDC=/usr/lib 318 if [ -d /usr/X11R6/lib ]; then _LDC="${_LDC} /usr/X11R6/lib" ; fi 319 if [ -d /usr/X386/lib ]; then _LDC="${_LDC} /usr/X386/lib" ; fi 320 if [ -d /usr/local/lib ]; then _LDC="${_LDC} /usr/local/lib" ; fi 321 echo 'setting ldconfig path:' ${_LDC} 322 ldconfig ${_LDC} 323fi 324 325# configure implementation specific stuff 326arch=`uname -m` 327if [ -f /etc/rc.${arch} ]; then 328 . /etc/rc.${arch} 329fi 330 331# for each valid dir in $local_startup, search for init scripts matching *.sh 332if [ "X${local_startup}" != X"NO" ]; then 333 echo -n 'Local package startup:' 334 for dir in ${local_startup}; do 335 [ -d ${dir} ] && for script in ${dir}/*.sh; do 336 [ -x ${script} ] && ${script} start 337 done 338 done 339 echo . 340fi 341 342# Do traditional (but rather obsolete) rc.local file if it exists. 343[ -f /etc/rc.local ] && sh /etc/rc.local 344 345date 346exit 0 347