Home | History | Annotate | Line # | Download | only in etc
rc revision 1.34
      1  1.26  deraadt #	@(#)rc	5.27 (Berkeley) 6/5/91
      2  1.34      cgd #	$Id: rc,v 1.34 1994/02/26 03:29:27 cgd Exp $
      3   1.1      cgd 
      4   1.1      cgd # System startup script run by init on autoboot
      5   1.1      cgd # or after single-user.
      6   1.1      cgd # Output and error are redirected to console by init,
      7   1.1      cgd # and the console is the controlling terminal.
      8   1.1      cgd 
      9   1.1      cgd stty status '^T'
     10   1.1      cgd 
     11   1.1      cgd # Set shell to ignore SIGINT (2), but not children;
     12   1.1      cgd # shell catches SIGQUIT (3) and returns to single user after fsck.
     13   1.1      cgd trap : 2
     14   1.1      cgd trap : 3	# shouldn't be needed
     15   1.1      cgd 
     16   1.1      cgd HOME=/; export HOME
     17   1.1      cgd PATH=/sbin:/bin:/usr/sbin:/usr/bin
     18   1.1      cgd export PATH
     19   1.1      cgd 
     20  1.17  mycroft if [ -e /fastboot ]
     21   1.1      cgd then
     22   1.1      cgd 	echo Fast boot ... skipping disk checks
     23   1.1      cgd elif [ $1x = autobootx ]
     24   1.1      cgd then
     25   1.1      cgd 	echo Automatic reboot in progress...
     26   1.1      cgd 	fsck -p
     27   1.1      cgd 	case $? in
     28   1.1      cgd 	0)
     29   1.1      cgd 		;;
     30   1.1      cgd 	2)
     31   1.1      cgd 		exit 1
     32   1.1      cgd 		;;
     33   1.1      cgd 	4)
     34   1.1      cgd 		reboot
     35   1.1      cgd 		echo "reboot failed... help!"
     36   1.1      cgd 		exit 1
     37   1.1      cgd 		;;
     38   1.1      cgd 	8)
     39   1.1      cgd 		echo "Automatic file system check failed... help!"
     40   1.1      cgd 		exit 1
     41   1.1      cgd 		;;
     42   1.1      cgd 	12)
     43   1.1      cgd 		echo "Reboot interrupted"
     44   1.1      cgd 		exit 1
     45   1.1      cgd 		;;
     46   1.1      cgd 	130)
     47   1.1      cgd 		# interrupt before catcher installed
     48   1.1      cgd 		exit 1
     49   1.1      cgd 		;;
     50   1.1      cgd 	*)
     51   1.1      cgd 		echo "Unknown error in reboot"
     52   1.1      cgd 		exit 1
     53   1.1      cgd 		;;
     54   1.1      cgd 	esac
     55   1.1      cgd fi
     56   1.1      cgd 
     57   1.1      cgd trap "echo 'Reboot interrupted'; exit 1" 3
     58   1.1      cgd 
     59   1.1      cgd swapon -a
     60   1.1      cgd 
     61   1.1      cgd umount -a >/dev/null 2>&1
     62   1.1      cgd mount -a -t nonfs
     63   1.1      cgd rm -f /fastboot		# XXX (root now writeable)
     64   1.1      cgd 
     65   1.1      cgd # set hostname, turn on network
     66   1.1      cgd echo 'starting network'
     67   1.1      cgd . /etc/netstart
     68   1.1      cgd 
     69  1.26  deraadt mount /usr >/dev/null 2>&1
     70  1.26  deraadt 
     71  1.26  deraadt echo -n 'starting rpc daemons:'
     72  1.26  deraadt echo -n ' portmap';		portmap
     73  1.26  deraadt 
     74  1.26  deraadt if [ -f /usr/sbin/ypbind -a -d /var/yp ]; then
     75  1.26  deraadt 	echo -n ' ypbind';		ypbind
     76  1.26  deraadt fi
     77  1.26  deraadt 
     78  1.26  deraadt # $nfs_server is imported from /etc/netstart;
     79  1.26  deraadt # if $nfs_server == YES, the machine is setup for being an nfs server
     80  1.26  deraadt if [ X${nfs_server} = X"YES" -a -r /etc/exports ]; then
     81  1.26  deraadt 	rm -f /var/db/mountdtab	
     82  1.26  deraadt 	echo -n ' mountd';		mountd
     83  1.26  deraadt 	echo -n ' nfsd';		nfsd -u 0,0,4 -t 0,0
     84  1.26  deraadt fi
     85  1.26  deraadt 
     86  1.26  deraadt # $nfs_client is imported from /etc/netstart;
     87  1.26  deraadt # if $nfs_client == YES, the machine is setup for being an nfs client
     88  1.26  deraadt if [ X${nfs_client} = X"YES" ]; then
     89  1.26  deraadt 	echo -n ' nfsiod';		nfsiod 4
     90  1.26  deraadt fi
     91  1.26  deraadt 
     92  1.27  deraadt if [ X${amd} = X"YES" ]; then
     93  1.27  deraadt 	echo -n ' amd'
     94  1.27  deraadt 	amd -x error,noinfo,nostats -a /tmp_mnt /home amd.home
     95  1.27  deraadt fi
     96  1.27  deraadt 
     97  1.26  deraadt echo '.'
     98  1.27  deraadt mount -a -t nfs
     99   1.1      cgd 
    100   1.1      cgd # clean up left-over files
    101   1.1      cgd rm -f /etc/nologin
    102   1.1      cgd rm -f /var/spool/uucp/LCK.*
    103   1.1      cgd rm -f /var/spool/uucp/STST/*
    104   1.1      cgd (cd /var/run && { rm -rf -- *; cp /dev/null utmp; chmod 644 utmp; })
    105  1.23  mycroft 
    106  1.23  mycroft echo 'runtime link editor directory cache'
    107  1.23  mycroft rm -f /var/run/ld.so.hints
    108  1.23  mycroft ldconfig
    109   1.1      cgd 
    110   1.1      cgd echo -n 'starting system logger'
    111   1.1      cgd rm -f /dev/log
    112   1.1      cgd syslogd
    113   1.1      cgd 
    114  1.19      cgd # $timed_flags is imported from /etc/netstart;
    115  1.19      cgd # if $timed_flags == NO, timed isn't run.
    116  1.21      cgd if [ "X${timed_flags}" != X"NO" ]; then
    117  1.19      cgd 	echo -n ', time daemon'; timed $timed_flags
    118   1.1      cgd fi
    119   1.1      cgd echo '.'
    120   1.1      cgd 
    121   1.1      cgd # /var/crash should be a directory or a symbolic link
    122   1.1      cgd # to the crash directory if core dumps are to be saved.
    123   1.1      cgd if [ -d /var/crash ]; then
    124   1.1      cgd 	echo checking for core dump...
    125   1.1      cgd 	savecore /var/crash
    126   1.1      cgd fi
    127   1.1      cgd 
    128   1.1      cgd #				echo -n 'checking quotas:'
    129   1.1      cgd #quotacheck -a
    130   1.1      cgd #				echo ' done.'
    131   1.1      cgd #quotaon -a
    132   1.1      cgd 
    133   1.1      cgd # build ps databases
    134   1.2      cgd echo 'building databases...'
    135  1.11      cgd kvm_mkdb /netbsd
    136   1.1      cgd dev_mkdb
    137   1.1      cgd 
    138   1.1      cgd chmod 666 /dev/tty[pqrs]*
    139   1.1      cgd 
    140   1.1      cgd # check the password temp/lock file
    141   1.1      cgd if [ -f /etc/ptmp ]
    142   1.1      cgd then
    143   1.1      cgd 	logger -s -p auth.err \
    144   1.1      cgd 	'password file may be incorrect -- /etc/ptmp exists'
    145   1.1      cgd fi
    146   1.1      cgd 
    147  1.32  mycroft virecovery=/var/tmp/vi.recover/recover.*
    148  1.32  mycroft if [ "$virecovery" != "/var/tmp/vi.recover/recover.*" ]; then
    149  1.32  mycroft 	echo preserving editor files
    150  1.32  mycroft 	for i in $virecovery; do
    151  1.32  mycroft 		sendmail -t < $i
    152  1.32  mycroft 	done
    153  1.32  mycroft fi
    154   1.1      cgd 
    155   1.1      cgd echo clearing /tmp
    156   1.1      cgd 
    157   1.1      cgd # prune quickly with one rm, then use find to clean up /tmp/[lq]*
    158   1.1      cgd # (not needed with mfs /tmp, but doesn't hurt there...)
    159   1.1      cgd (cd /tmp && rm -rf [a-km-pr-zA-Z]* &&
    160  1.13      cgd     find . ! -name . ! -name lost+found ! -name quotas \
    161  1.13      cgd 	-exec rm -rf -- {} \; -type d -prune)
    162   1.1      cgd 
    163  1.34      cgd if [ -f /var/account/acct ]; then
    164  1.34      cgd 	echo 'turning on accounting';	accton /var/account/acct
    165  1.34      cgd fi
    166   1.1      cgd 
    167   1.1      cgd echo -n standard daemons:
    168   1.1      cgd echo -n ' update';		update
    169  1.31      jtc echo -n ' cron';		cron
    170   1.1      cgd echo '.'
    171   1.1      cgd 
    172   1.1      cgd echo -n starting network daemons:
    173   1.1      cgd 
    174  1.19      cgd # $gated and $routed_flags are imported from /etc/netstart.
    175   1.1      cgd # If $gated == YES, gated is used; otherwise routed.
    176  1.19      cgd # If $routed_flags == NO, routed isn't run.
    177   1.1      cgd if [ X${gated} = X"YES" -a -r /etc/gated.conf ]; then
    178  1.19      cgd 	echo -n ' gated';	gated $gated_flags
    179  1.21      cgd elif [ "X${routed_flags}" != X"NO" ]; then
    180  1.19      cgd 	echo -n ' routed';	routed $routed_flags
    181   1.1      cgd fi
    182   1.1      cgd 
    183  1.19      cgd # $name_server is imported from /etc/netstart;
    184  1.19      cgd # if $name_server == YES, named is run.
    185   1.1      cgd if [ X${name_server} = X"YES" -a -r /etc/named.boot ]; then
    186   1.1      cgd 	echo -n ' named';		named
    187  1.29  mycroft fi
    188  1.29  mycroft 
    189   1.1      cgd # $rwhod is imported from /etc/netstart;
    190   1.2      cgd # if $rwhod == YES, rwhod is run.
    191   1.5      cgd if [ X${rwhod} = X"YES" ]; then
    192   1.1      cgd 	echo -n ' rwhod';	rwhod
    193   1.1      cgd fi
    194   1.1      cgd 
    195   1.1      cgd echo -n ' printer';		lpd
    196   1.6      cgd 
    197  1.19      cgd # $sendmail_flags is imported from /etc/netstart;
    198  1.24      cgd # If $sendmail_flags == NO or /etc/sendmail.cf doesn't exist, then
    199  1.24      cgd # sendmail isn't run.
    200  1.24      cgd if [ "X${sendmail_flags}" != X"NO" -a -r /etc/sendmail.cf ]; then
    201  1.19      cgd 	echo -n ' sendmail';		sendmail ${sendmail_flags}
    202  1.19      cgd fi
    203  1.19      cgd 
    204   1.1      cgd echo -n ' inetd';		inetd
    205  1.30  mycroft 
    206  1.30  mycroft # $rarpd_flags is importent from /etc/netstart;
    207  1.30  mycroft # If $rarpd_flags == NO or /etc/ethers doesn't exist, then
    208  1.30  mycroft # rarpd isn't run.
    209  1.30  mycroft if [ "X${rarpd_flags}" != X"NO" -a -r /etc/ethers ]; then
    210  1.30  mycroft 	echo -n ' rarpd';		rarpd ${rarpd_flags}
    211  1.30  mycroft fi
    212  1.30  mycroft 
    213  1.30  mycroft # $bootparamd_flags is importent from /etc/netstart;
    214  1.30  mycroft # If $bootparamd_flags == NO or /etc/bootparams doesn't exist, then
    215  1.30  mycroft # bootparamd isn't run.
    216  1.30  mycroft if [ "X${bootparamd_flags}" != X"NO" -a -r /etc/bootparams ]; then
    217  1.30  mycroft 	echo -n ' rpc.bootparamd';	rpc.bootparamd ${bootparamd_flags}
    218  1.30  mycroft fi
    219  1.30  mycroft 
    220   1.1      cgd echo '.'
    221   1.1      cgd 
    222  1.25  mycroft . /etc/rc.local
    223   1.1      cgd 
    224   1.1      cgd date
    225   1.1      cgd 
    226   1.1      cgd exit 0
    227