rc revision 872
1709Swollman#!/bin/sh 2872Sache# $Id: rc,v 1.8 1993/12/13 08:28:03 davidg Exp $ 3709Swollman# From: @(#)rc 5.27 (Berkeley) 6/5/91 437Srgrimes 537Srgrimes# System startup script run by init on autoboot 637Srgrimes# or after single-user. 737Srgrimes# Output and error are redirected to console by init, 837Srgrimes# and the console is the controlling terminal. 937Srgrimes 1037Srgrimesstty status '^T' 1137Srgrimes 1237Srgrimes# Set shell to ignore SIGINT (2), but not children; 1337Srgrimes# shell catches SIGQUIT (3) and returns to single user after fsck. 1437Srgrimestrap : 2 1537Srgrimestrap : 3 # shouldn't be needed 1637Srgrimes 1737SrgrimesHOME=/; export HOME 1837SrgrimesPATH=/sbin:/bin:/usr/sbin:/usr/bin 1937Srgrimesexport PATH 2037Srgrimes 21323Sswallaceif [ -e /fastboot ] 2237Srgrimesthen 2337Srgrimes echo Fast boot ... skipping disk checks 2437Srgrimeselif [ $1x = autobootx ] 2537Srgrimesthen 2637Srgrimes echo Automatic reboot in progress... 2737Srgrimes fsck -p 2837Srgrimes case $? in 2937Srgrimes 0) 3037Srgrimes ;; 3137Srgrimes 2) 3237Srgrimes exit 1 3337Srgrimes ;; 3437Srgrimes 4) 3537Srgrimes reboot 3637Srgrimes echo "reboot failed... help!" 3737Srgrimes exit 1 3837Srgrimes ;; 3937Srgrimes 8) 4037Srgrimes echo "Automatic file system check failed... help!" 4137Srgrimes exit 1 4237Srgrimes ;; 4337Srgrimes 12) 4437Srgrimes echo "Reboot interrupted" 4537Srgrimes exit 1 4637Srgrimes ;; 4737Srgrimes 130) 4837Srgrimes # interrupt before catcher installed 4937Srgrimes exit 1 5037Srgrimes ;; 5137Srgrimes *) 5237Srgrimes echo "Unknown error in reboot" 5337Srgrimes exit 1 5437Srgrimes ;; 5537Srgrimes esac 5637Srgrimesfi 5737Srgrimes 5837Srgrimestrap "echo 'Reboot interrupted'; exit 1" 3 5937Srgrimes 6037Srgrimesswapon -a 6137Srgrimes 6237Srgrimesumount -a >/dev/null 2>&1 6337Srgrimesmount -a -t nonfs 6437Srgrimesrm -f /fastboot # XXX (root now writeable) 6537Srgrimes 66872Sache# If the machine runs wall CMOS clock (compatible with MSDOS), 67872Sache# activate following line by creating empty file /etc/wall_cmos_clock 68872Sache# If this file not exist, following line does nothing (assumed 69872Sache# the machine runs UTC CMOS clock). See adjkerntz(8) for details. 70872Sacheadjkerntz -i 71872Sache 7237Srgrimes# set hostname, turn on network 7337Srgrimesecho 'starting network' 7437Srgrimes. /etc/netstart 7537Srgrimes 7637Srgrimesmount -a -t nfs >/dev/null 2>&1 & # XXX shouldn't need background 7737Srgrimes 7837Srgrimes# clean up left-over files 7937Srgrimesrm -f /etc/nologin 8037Srgrimesrm -f /var/spool/uucp/LCK.* 8137Srgrimesrm -f /var/spool/uucp/STST/* 8237Srgrimes(cd /var/run && { rm -rf -- *; cp /dev/null utmp; chmod 644 utmp; }) 8337Srgrimes 84796Srichif [ -x /sbin/ldconfig ]; then 85796Srich ldconfig /usr/X386/lib 86796Srichfi 87796Srich 8837Srgrimesecho -n 'starting system logger' 8937Srgrimesrm -f /dev/log 9037Srgrimessyslogd 9137Srgrimes 9237Srgrimes# $timedflags is imported from /etc/netstart; 9337Srgrimes# if $timedflags == NO, timed isn't run. 9437Srgrimesif [ X${timedflags} != X"NO" ]; then 9537Srgrimes echo -n ', time daemon'; timed $timedflags 9637Srgrimesfi 9737Srgrimesecho '.' 9837Srgrimes 9937Srgrimes# /var/crash should be a directory or a symbolic link 10037Srgrimes# to the crash directory if core dumps are to be saved. 10137Srgrimesif [ -d /var/crash ]; then 10237Srgrimes echo checking for core dump... 10337Srgrimes savecore /var/crash 10437Srgrimesfi 10537Srgrimes 10637Srgrimes# echo -n 'checking quotas:' 10737Srgrimes#quotacheck -a 10837Srgrimes# echo ' done.' 10937Srgrimes#quotaon -a 11037Srgrimes 11137Srgrimes# build ps databases 11237Srgrimeskvm_mkdb /386bsd 11337Srgrimesdev_mkdb 11437Srgrimes 11537Srgrimeschmod 666 /dev/tty[pqrs]* 11637Srgrimes 11737Srgrimes# check the password temp/lock file 11837Srgrimesif [ -f /etc/ptmp ] 11937Srgrimesthen 12037Srgrimes logger -s -p auth.err \ 12137Srgrimes 'password file may be incorrect -- /etc/ptmp exists' 12237Srgrimesfi 12337Srgrimes 12437Srgrimesecho preserving editor files 12537Srgrimes(cd /var/tmp && /usr/libexec/elvispreserve "-the system rebooted" elvis* && 12637Srgrimes rm -f elvis[0-9a-f][0-9a-f][0-9a-f][0-9a-f]* \ 12737Srgrimes elvis_[0-9a-f][0-9a-f][0-9a-f][0-9a-f]*) 12837Srgrimes 12937Srgrimesecho clearing /tmp 13037Srgrimes 13137Srgrimes# prune quickly with one rm, then use find to clean up /tmp/[lq]* 13237Srgrimes# (not needed with mfs /tmp, but doesn't hurt there...) 13337Srgrimes(cd /tmp && rm -rf [a-km-pr-zA-Z]* && 13437Srgrimes find . ! -name . ! -name lost+found ! -name quotas -exec rm -rf -- {} \;) 13537Srgrimes 13637Srgrimes# echo 'turning on accounting'; accton /var/account/acct 13737Srgrimes 13837Srgrimesecho -n standard daemons: 13937Srgrimesecho -n ' crond'; /usr/libexec/crond 14037Srgrimesecho '.' 14137Srgrimes 14237Srgrimesecho -n starting network daemons: 14337Srgrimes 144857Sdg# Portmapper should always be run, to provide RPC services for inetd. 145857Sdgif [ -x /usr/sbin/portmap ]; then 146857Sdg echo -n ' portmap'; portmap 147857Sdgfi 148857Sdg 14937Srgrimes# $gated and $routedflags are imported from /etc/netstart. 15037Srgrimes# If $gated == YES, gated is used; otherwise routed. 15137Srgrimes# If $routedflags == NO, routed isn't run. 15237Srgrimesif [ X${gated} = X"YES" -a -r /etc/gated.conf ]; then 15337Srgrimes echo -n ' gated'; gated $gatedflags 15437Srgrimeselif [ X${routedflags} != X"NO" ]; then 15537Srgrimes echo -n ' routed'; routed $routedflags 15637Srgrimesfi 15737Srgrimes 15837Srgrimesif [ X${name_server} = X"YES" -a -r /etc/named.boot ]; then 15937Srgrimes echo -n ' named'; named 16037Srgrimesfi 16137Srgrimes 16237Srgrimes# $rwhod is imported from /etc/netstart; 16337Srgrimes# if $rwhod is set to something other than NO, rwhod is run. 16437Srgrimesif [ ${rwhod-NO} != "NO" ]; then 16537Srgrimes echo -n ' rwhod'; rwhod 16637Srgrimesfi 16737Srgrimes 16837Srgrimesecho -n ' printer'; lpd 16937Srgrimes 17037Srgrimesif [ X${nfs_server} = X"YES" -a -r /etc/exports ]; then 17137Srgrimes echo -n ' mountd'; mountd 17237Srgrimes echo -n ' nfsd'; nfsd -u 0,0,4 -t 0,0 17337Srgrimes echo -n ' nfsiod'; nfsiod 4 17437Srgrimesfi 17537Srgrimes 176709Swollman# $sendmail_flags is imported from /etc/netstart; 177709Swollman# if $sendmail_flags is something other than NO, sendmail is run. 178810Srichif [ X"${sendmail_flags}" = X"NO" -a -r /etc/sendmail.cf ]; then 179709Swollman echo -n ' sendmail'; sendmail ${sendmail_flags} 180709Swollmanfi 181709Swollman 18237Srgrimesecho -n ' inetd'; inetd 18337Srgrimesecho '.' 18437Srgrimes 18537Srgrimessh /etc/rc.local 18637Srgrimes 18737Srgrimesdate 18837Srgrimes 18937Srgrimesexit 0 190