Home | History | Annotate | Line # | Download | only in etc
rc revision 1.1.1.2
      1 #	@(#)rc	8.2 (Berkeley) 3/17/94
      2 
      3 # System startup script run by init on autoboot
      4 # or after single-user.
      5 # Output and error are redirected to console by init,
      6 # and the console is the controlling terminal.
      7 
      8 stty status '^T'
      9 
     10 # Set shell to ignore SIGINT (2), but not children;
     11 # shell catches SIGQUIT (3) and returns to single user after fsck.
     12 trap : 2
     13 trap : 3	# shouldn't be needed
     14 
     15 HOME=/; export HOME
     16 PATH=/sbin:/bin:/usr/sbin:/usr/bin
     17 export PATH
     18 
     19 if [ -r /fastboot ]
     20 then
     21 	echo "Fast boot: skipping disk checks."
     22 elif [ $1x = autobootx ]
     23 then
     24 	echo "Automatic boot in progress: starting file system checks."
     25 	fsck -p
     26 	case $? in
     27 	0)
     28 		;;
     29 	2)
     30 		exit 1
     31 		;;
     32 	4)
     33 		echo "Rebooting..."
     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 "Boot interrupted."
     44 		exit 1
     45 		;;
     46 	130)
     47 		# interrupt before catcher installed
     48 		exit 1
     49 		;;
     50 	*)
     51 		echo "Unknown error; help!"
     52 		exit 1
     53 		;;
     54 	esac
     55 fi
     56 
     57 trap "echo 'Boot interrupted.'; exit 1" 3
     58 
     59 swapon -a
     60 
     61 umount -a >/dev/null 2>&1
     62 mount -a -t nonfs
     63 rm -f /fastboot		# XXX (root now writeable)
     64 
     65 # set hostname, turn on network
     66 echo 'starting network'
     67 . /etc/netstart
     68 
     69 mount -a -t nfs >/dev/null 2>&1 &	# XXX shouldn't need background
     70 
     71 # clean up left-over files
     72 rm -f /etc/nologin
     73 rm -f /var/spool/uucp/LCK.*
     74 rm -f /var/spool/uucp/STST/*
     75 (cd /var/run && { rm -rf -- *; install -c -m 664 -g utmp /dev/null utmp; })
     76 
     77 echo -n 'starting system logger'
     78 rm -f /dev/log
     79 syslogd
     80 
     81 # $timedflags is imported from /etc/netstart;
     82 # if $timedflags == NO, timed isn't run.
     83 if [ X${timedflags} != X"NO" ]; then
     84 	echo -n ', time daemon'; timed $timedflags
     85 fi
     86 echo '.'
     87 
     88 # /var/crash should be a directory or a symbolic link
     89 # to the crash directory if core dumps are to be saved.
     90 if [ -d /var/crash ]; then
     91 	echo checking for core dump...
     92 	savecore /var/crash
     93 fi
     94 
     95 				echo -n 'checking quotas:'
     96 quotacheck -a
     97 				echo ' done.'
     98 quotaon -a
     99 
    100 # build ps databases
    101 kvm_mkdb
    102 dev_mkdb
    103 
    104 chmod 666 /dev/tty[pqrs]*
    105 
    106 # check the password temp/lock file
    107 if [ -f /etc/ptmp ]
    108 then
    109 	logger -s -p auth.err \
    110 	'password file may be incorrect -- /etc/ptmp exists'
    111 fi
    112 
    113 echo preserving editor files
    114 (cd /var/tmp && /usr/libexec/ex3.7preserve -a &&
    115      rm -f Ex[0-9][0-9][0-9][0-9][0-9] Rx[0-9][0-9][0-9][0-9][0-9])
    116 
    117 echo clearing /tmp
    118 
    119 # Prune quickly with one rm, then use find to clean up /tmp/[lq]* (this
    120 # is not needed with mfs /tmp, but doesn't hurt anything).
    121 (cd /tmp && rm -rf [a-km-pr-zA-Z]* &&
    122     find . ! -name . ! -name lost+found ! -name quotas -type d -prune \
    123 	-exec rm -rf -- {} \;)
    124 
    125 echo 'turning on accounting';	accton /var/account/acct
    126 
    127 echo -n standard daemons:
    128 echo -n ' update';		update
    129 echo -n ' cron';		cron
    130 echo '.'
    131 
    132 echo -n starting network daemons:
    133 
    134 # $gated and $routedflags are imported from /etc/netstart.
    135 # If $gated == YES, gated is used; otherwise routed.
    136 # If $routedflags == NO, routed isn't run.
    137 if [ X${gated} = X"YES" -a -r /etc/gated.conf ]; then
    138 	echo -n ' gated';	gated $gatedflags
    139 elif [ X${routedflags} != X"NO" ]; then
    140 	echo -n ' routed';	routed $routedflags
    141 fi
    142 
    143 echo -n ' named';		named
    144 
    145 # $rwhod is imported from /etc/netstart;
    146 # if $rwhod is set to something other than NO, rwhod is run.
    147 if [ ${rwhod-NO} != "NO" ]; then
    148 	echo -n ' rwhod';	rwhod
    149 fi
    150 
    151 echo -n ' printer';		lpd
    152 
    153 echo -n ' portmap';		portmap
    154 echo -n ' mountd';		mountd
    155 echo -n ' nfsd';		nfsd -u -t 6
    156 echo -n ' nfsiod';		nfsiod 4
    157 
    158 echo -n ' sendmail';		sendmail -bd -q30m
    159 echo -n ' inetd';		inetd
    160 echo -n ' amd';
    161 	cd /; amd -l /var/log/amd -r -a /amd -p > /var/run/amd.pid \
    162 	/home /etc/amd-home \
    163 	/n /etc/amd-n \
    164 	&
    165 
    166 echo '.'
    167 
    168 sh /etc/rc.local
    169 
    170 date
    171 exit 0
    172