home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Source Code 1993 July / THE_SOURCE_CODE_CD_ROM.iso / bsd_srcs / etc / rc < prev    next >
Encoding:
Text File  |  1991-06-05  |  3.4 KB  |  164 lines

  1. #    @(#)rc    5.27 (Berkeley) 6/5/91
  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 reboot in progress...
  25.     fsck -p
  26.     case $? in
  27.     0)
  28.         ;;
  29.     2)
  30.         exit 1
  31.         ;;
  32.     4)
  33.         reboot
  34.         echo "reboot failed... help!"
  35.         exit 1
  36.         ;;
  37.     8)
  38.         echo "Automatic file system check failed... help!"
  39.         exit 1
  40.         ;;
  41.     12)
  42.         echo "Reboot interrupted"
  43.         exit 1
  44.         ;;
  45.     130)
  46.         # interrupt before catcher installed
  47.         exit 1
  48.         ;;
  49.     *)
  50.         echo "Unknown error in reboot"
  51.         exit 1
  52.         ;;
  53.     esac
  54. fi
  55.  
  56. trap "echo 'Reboot interrupted'; exit 1" 3
  57.  
  58. swapon -a
  59.  
  60. umount -a >/dev/null 2>&1
  61. mount -a -t nonfs
  62. rm -f /fastboot        # XXX (root now writeable)
  63.  
  64. # set hostname, turn on network
  65. echo 'starting network'
  66. . /etc/netstart
  67.  
  68. mount -a -t nfs >/dev/null 2>&1 &    # XXX shouldn't need background
  69.  
  70. # clean up left-over files
  71. rm -f /etc/nologin
  72. rm -f /var/spool/uucp/LCK.*
  73. rm -f /var/spool/uucp/STST/*
  74. (cd /var/run && { rm -rf -- *; cp /dev/null utmp; chmod 644 utmp; })
  75.  
  76. echo -n 'starting system logger'
  77. rm -f /dev/log
  78. syslogd
  79.  
  80. # $timedflags is imported from /etc/netstart;
  81. # if $timedflags == NO, timed isn't run.
  82. if [ X${timedflags} != X"NO" ]; then
  83.     echo -n ', time daemon'; timed $timedflags
  84. fi
  85. echo '.'
  86.  
  87. # /var/crash should be a directory or a symbolic link
  88. # to the crash directory if core dumps are to be saved.
  89. if [ -d /var/crash ]; then
  90.     echo checking for core dump...
  91.     savecore /var/crash
  92. fi
  93.  
  94.                 echo -n 'checking quotas:'
  95. quotacheck -a
  96.                 echo ' done.'
  97. quotaon -a
  98.  
  99. # build ps databases
  100. kvm_mkdb /vmunix
  101. dev_mkdb
  102.  
  103. chmod 666 /dev/tty[pqrs]*
  104.  
  105. # check the password temp/lock file
  106. if [ -f /etc/ptmp ]
  107. then
  108.     logger -s -p auth.err \
  109.     'password file may be incorrect -- /etc/ptmp exists'
  110. fi
  111.  
  112. echo preserving editor files
  113. (cd /var/tmp && /usr/libexec/ex3.7preserve -a &&
  114.      rm -f Ex[0-9][0-9][0-9][0-9][0-9] Rx[0-9][0-9][0-9][0-9][0-9])
  115.  
  116. echo clearing /tmp
  117.  
  118. # prune quickly with one rm, then use find to clean up /tmp/[lq]*
  119. # (not needed with mfs /tmp, but doesn't hurt there...)
  120. (cd /tmp && rm -rf [a-km-pr-zA-Z]* &&
  121.     find . ! -name . ! -name lost+found ! -name quotas -exec rm -rf -- {} \;)
  122.  
  123. echo 'turning on accounting';    accton /var/account/acct
  124.  
  125. echo -n standard daemons:
  126. echo -n ' update';        update
  127. echo -n ' cron';        cron
  128. echo '.'
  129.  
  130. echo -n starting network daemons:
  131.  
  132. # $gated and $routedflags are imported from /etc/netstart.
  133. # If $gated == YES, gated is used; otherwise routed.
  134. # If $routedflags == NO, routed isn't run.
  135. if [ X${gated} = X"YES" -a -r /etc/gated.conf ]; then
  136.     echo -n ' gated';    gated $gatedflags
  137. elif [ X${routedflags} != X"NO" ]; then
  138.     echo -n ' routed';    routed $routedflags
  139. fi
  140.  
  141. echo -n ' named';        named
  142.  
  143. # $rwhod is imported from /etc/netstart;
  144. # if $rwhod is set to something other than NO, rwhod is run.
  145. if [ ${rwhod-NO} != "NO" ]; then
  146.     echo -n ' rwhod';    rwhod
  147. fi
  148.  
  149. echo -n ' printer';        lpd
  150.  
  151. echo -n ' portmap';        portmap
  152. echo -n ' mountd';        mountd
  153. echo -n ' nfsd';        nfsd -u 0,0,4 -t 0,0
  154. echo -n ' nfsiod';        nfsiod 4
  155.  
  156. echo -n ' sendmail';        sendmail -bd -q30m
  157. echo -n ' inetd';        inetd
  158. echo '.'
  159.  
  160. sh /etc/rc.local
  161.  
  162. date
  163. exit 0
  164.