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