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