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