rc revision 15684
1#!/bin/sh 2# $Id: rc,v 1.88 1996/05/03 05:37:04 asami 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 87# If the machine runs wall CMOS clock (compatible with MSDOS), 88# activate following line by creating empty file /etc/wall_cmos_clock 89# If this file not exist, following line does nothing (assumed 90# the machine runs UTC CMOS clock). See adjkerntz(8) for details. 91adjkerntz -i 92 93# If there is a global system configuration file, suck it in. 94if [ -f /etc/sysconfig ]; then 95 . /etc/sysconfig 96fi 97 98# configure serial devices 99if [ -f /etc/rc.serial ]; then 100 . /etc/rc.serial 101fi 102 103# start up PC-card configuration 104if [ -f /etc/rc.pccard ]; then 105 . /etc/rc.pccard 106fi 107 108# start up the network 109if [ -f /etc/netstart ]; then 110 sh /etc/netstart 111fi 112 113mount -a -t nfs >/dev/null 2>&1 114 115# Whack the pty perms back into shape. 116chmod 666 /dev/tty[pqrs]* 117 118# clean up left-over files 119rm -f /etc/nologin 120rm -f /var/spool/lock/* 121rm -rf /var/spool/uucp/.Temp/* 122rm -f /dev/log 123(cd /var/run && { cp /dev/null utmp; chmod 644 utmp; }) 124 125echo clearing /tmp 126 127# prune quickly with one rm, then use find to clean up /tmp/[lq]* 128# (not needed with mfs /tmp, but doesn't hurt there...) 129(cd /tmp && rm -rf [a-km-pr-zA-Z]* && 130 find -d . ! -name . ! -name lost+found ! -name quotas -exec rm -rf -- {} \;) 131 132# enable dumpdev so that savecore can see it 133if [ "X${dumpdev}" != X"NO" ]; then 134 dumpon ${dumpdev} 135fi 136 137# /var/crash should be a directory or a symbolic link 138# to the crash directory if core dumps are to be saved. 139if [ "X${savecore}" = X"YES" -a -d /var/crash ]; then 140 echo -n checking for core dump... 141 savecore /var/crash 142fi 143 144# snapshot any kernel -c changes back to disk 145echo 'recording kernel -c changes' 146/sbin/dset -q 147 148# Check the quotas 149if [ "X${check_quotas}" = X"YES" ]; then 150 echo 'checking quotas:' 151 quotacheck -a 152 echo ' done.' 153 quotaon -a 154fi 155 156# start system logging and name service (named needs to start before syslogd 157# if you don't have a /etc/resolv.conf) 158# 159echo -n starting system daemons: 160 161echo ' syslogd.'; syslogd 162 163echo -n starting network daemons: 164 165# $namedflags is imported from /etc/sysconfig 166if [ "X${namedflags}" != "XNO" ]; then 167 echo -n ' named'; named $namedflags 168fi 169 170# $ntpdate and $xntpdflags are imported from /etc/sysconfig. 171# If $ntpdate != NO, run ntpdate $ntpdate to set the date correctly. 172# If $xntpdflags != NO, start xntpd. 173if [ "X${ntpdate}" != X"NO" -o "X${xntpdflags}" != X"NO" ]; then 174 if [ "X${tickadjflags}" != X"NO" ]; then 175 echo -n ' tickadj'; tickadj ${tickadjflags--Aq} 176 fi 177 178 if [ "X${ntpdate}" != X"NO" ]; then 179 echo -n ' ntpdate'; ntpdate ${ntpdate} >/dev/null 2>&1 180 fi 181 182 if [ "X${xntpdflags}" != X"NO" ]; then 183 echo -n ' xntpd'; xntpd ${xntpdflags} 184 fi 185fi 186 187# $timedflags is imported from /etc/sysconfig; 188# if $timedflags == NO, timed isn't run. 189if [ "X${timedflags}" != X"NO" ]; then 190 echo -n ' timed'; timed $timedflags 191fi 192 193# Portmapper should always be run, to provide RPC services for inetd. 194if [ -x /usr/sbin/portmap ]; then 195 echo -n ' portmap'; portmap 196fi 197 198# Start ypserv if we're an NIS server. 199# Run yppasswdd only on the NIS master server 200if [ "X${nis_serverflags}" != X"NO" ]; then 201 echo -n ' ypserv'; ypserv ${nis_serverflags} 202 203 if [ "X${yppasswddflags}" != X"NO" ]; then 204 echo -n ' yppasswdd'; rpc.yppasswdd ${yppasswddflags} 205 fi 206fi 207 208# Start ypbind if we're an NIS client 209if [ "X${nis_clientflags}" != X"NO" ]; then 210 echo -n ' ypbind'; ypbind ${nis_clientflags} 211 if [ "X${nis_ypsetflags}" != X"NO" ]; then 212 echo -n ' ypset'; ypset ${nis_ypsetflags} 213 fi 214fi 215 216# $rwhod is imported from /etc/sysconfig; 217# if $rwhod is set to YES, rwhod is run. 218if [ "X${rwhod}" = X"YES" ]; then 219 echo -n ' rwhod'; rwhod 220fi 221 222if [ "X${nfs_server}" = X"YES" -a -r /etc/exports ]; then 223 echo -n ' mountd' 224 if [ "X${weak_mountd_authentication}" = X"YES" ]; then 225 mountd -n 226 else 227 mountd 228 fi 229 echo -n ' nfsd'; nfsd -u -t 4 230fi 231 232if [ "X${nfs_client}" = X"YES" ]; then 233 echo -n ' nfsiod'; nfsiod -n 4 234fi 235 236if [ "X${amdflags}" != X"NO" ]; then 237 echo -n ' amd' 238 amd ${amdflags} > /var/run/amd.pid 239fi 240 241# Kerberos runs ONLY on the Kerberos server machine 242if [ "X${kerberos_server}" = X"YES" ]; then 243 echo -n ' kerberos'; kerberos >> /var/log/kerberos.log & 244 echo -n ' kadmind'; \ 245 (sleep 20; kadmind -n >/dev/null 2>&1 &) & 246fi 247 248# IP multicast routing daemon 249if [ "X${mrouted}" != X"NO" -a -x /usr/sbin/mrouted ]; then 250 echo -n ' mrouted'; mrouted ${mrouted} 251fi 252 253echo -n ' inetd'; inetd 254echo '.' 255 256# build ps databases 257kvm_mkdb 258dev_mkdb 259 260# check the password temp/lock file 261if [ -f /etc/ptmp ] 262then 263 logger -s -p auth.err \ 264 "password file may be incorrect -- /etc/ptmp exists" 265fi 266 267# Recover vi editor files. 268virecovery=`echo /var/tmp/vi.recover/recover.*` 269if [ "$virecovery" != '/var/tmp/vi.recover/recover.*' ]; then 270 echo 'Recovering vi editor sessions' 271 for i in $virecovery; do 272 sendmail -t < $i 273 done 274fi 275 276if [ "X${accounting}" = X"YES" -a -d /var/account ]; then 277 echo 'turning on accounting' 278 if [ ! -e /var/account/acct ]; then 279 touch /var/account/acct 280 fi 281 accton /var/account/acct 282fi 283 284# Now start up miscellaneous daemons that don't belong anywhere else 285# 286echo -n standard daemons: 287echo -n ' cron'; cron 288 289if [ "X${lpd}" != X"NO" -a -x /usr/sbin/lpd ]; then 290 echo -n ' printer'; lpd 291fi 292 293# $sendmail_flags is imported from /etc/sysconfig; 294# if $sendmail_flags is something other than NO, sendmail is run. 295if [ "X${sendmail_flags}" != X"NO" -a -r /etc/sendmail.cf ]; then 296 echo -n ' sendmail'; /usr/sbin/sendmail ${sendmail_flags} 297fi 298 299echo '.' 300 301# Make shared lib searching a little faster. Leave /usr/lib first if you 302# add your own entries or you may come to grief. 303if [ -x /sbin/ldconfig ]; then 304 _LDC=/usr/lib 305 if [ -d /usr/X11R6/lib ]; then _LDC="${_LDC} /usr/X11R6/lib" ; fi 306 if [ -d /usr/X386/lib ]; then _LDC="${_LDC} /usr/X386/lib" ; fi 307 if [ -d /usr/local/lib ]; then _LDC="${_LDC} /usr/local/lib" ; fi 308 echo 'setting ldconfig path:' ${_LDC} 309 ldconfig ${_LDC} 310fi 311 312# configure implementation specific stuff 313arch=`uname -m` 314if [ -f /etc/rc.${arch} ]; then 315 . /etc/rc.${arch} 316fi 317 318# for each valid dir in $local_startup, search for init scripts matching *.sh 319if [ "X${local_startup}" != X"NO" ]; then 320 for dir in ${local_startup}; do 321 [ -d ${dir} ] && for script in ${dir}/*.sh; do 322 [ -x ${script} ] && ${script} start 323 done 324 done 325fi 326 327# Do traditional (but rather obsolete) rc.local file if it exists. 328[ -f /etc/rc.local ] && sh /etc/rc.local 329 330date 331exit 0 332