2 # $Id: rc,v 1.41 1994/11/26 19:25:14 ache Exp $
3 # From: @(#)rc 5.27 (Berkeley) 6/5/91
5 # System startup script run by init on autoboot
6 # or after single-user.
7 # Output and error are redirected to console by init,
8 # and the console is the controlling terminal.
12 # Set shell to ignore SIGINT (2), but not children;
13 # shell catches SIGQUIT (3) and returns to single user after fsck.
15 trap : 3 # shouldn't be needed
18 PATH=/sbin:/bin:/usr/sbin:/usr/bin
23 if [ $1x = autobootx ]
25 echo Automatic reboot in progress...
35 echo "reboot failed... help!"
39 echo "Automatic file system check failed... help!"
43 echo "Reboot interrupted"
47 # interrupt before catcher installed
51 echo "Unknown error in reboot"
56 echo Skipping disk checks ...
59 trap "echo 'Reboot interrupted'; exit 1" 3
61 # root must be read/write both for NFS diskless and for VFS LKMs before
62 # proceeding any further.
65 umount -a >/dev/null 2>&1
68 # This stuff needed for proper daemons tuning, comsat f.e.
69 # See profile and csh.login also.
70 # Uncomment next line if you want to setup your 8-bit locale at program
71 # startup automatically
72 # ENABLE_STARTUP_LOCALE=; export ENABLE_STARTUP_LOCALE
73 # Uncomment next line to activate russian locale
74 # LANG=ru_SU.KOI8-R; export LANG
75 # Uncomment next line to activate italian locale
76 # LANG=it_IT.ISO8859-1; export LANG
77 # For full locales list check /usr/share/locale/*
79 # If the machine runs wall CMOS clock (compatible with MSDOS),
80 # activate following line by creating empty file /etc/wall_cmos_clock
81 # If this file not exist, following line does nothing (assumed
82 # the machine runs UTC CMOS clock). See adjkerntz(8) for details.
85 # configure serial devices
86 if [ -f /etc/rc.serial ]
91 # set hostname, turn on network
92 echo 'starting network'
95 # clean up left-over files
97 rm -f /var/spool/lock/*
98 rm -f /var/spool/uucp/.Temp/*
99 (cd /var/run && { rm -rf -- *; cp /dev/null utmp; chmod 644 utmp; })
101 echo -n 'starting system logger'
105 # $timedflags is imported from /etc/netstart;
106 # if $timedflags == NO, timed isn't run.
107 if [ X${timedflags} != X"NO" ]; then
108 echo -n ', time daemon'; timed $timedflags
112 # /var/crash should be a directory or a symbolic link
113 # to the crash directory if core dumps are to be saved.
114 if [ X${savecore} != X"NO" -a -d /var/crash ]; then
115 echo checking for core dump...
119 # echo -n 'checking quotas:'
128 chmod 666 /dev/tty[pqrs]*
130 # check the password temp/lock file
133 logger -s -p auth.err \
134 'password file may be incorrect -- /etc/ptmp exists'
137 # Recover vi editor files.
138 virecovery=/var/tmp/vi.recover/recover.*
139 if [ "$virecovery" != "/var/tmp/vi.recover/recover.*" ]; then
140 echo 'Recovering vi editor sessions'
141 for i in $virecovery; do
148 # prune quickly with one rm, then use find to clean up /tmp/[lq]*
149 # (not needed with mfs /tmp, but doesn't hurt there...)
150 (cd /tmp && rm -rf [a-km-pr-zA-Z]* &&
151 find -d . ! -name . ! -name lost+found ! -name quotas -exec rm -rf -- {} \;)
153 # echo 'turning on accounting'; accton /var/account/acct
155 echo -n standard daemons:
156 echo -n ' cron'; cron
159 echo -n starting network daemons:
161 # Portmapper should always be run, to provide RPC services for inetd.
162 if [ -x /usr/sbin/portmap ]; then
163 echo -n ' portmap'; portmap
166 # $gated and $routedflags are imported from /etc/netstart.
167 # If $gated == YES, gated is used; otherwise routed.
168 # If $routedflags == NO, routed isn't run.
169 if [ X${gated} = X"YES" -a -r /etc/gated.conf ]; then
170 echo -n ' gated'; gated $gatedflags
171 elif [ X"${routedflags}" != X"NO" ]; then
172 echo -n ' routed'; routed $routedflags
175 if [ X${name_server} = X"YES" -a -r /etc/named.boot ]; then
176 echo -n ' named'; named
179 # $ntpdate and $xntpdflags are imported from /etc/netstart.
180 # If $ntpdate != NO, run ntpdate $ntpdate to set the date correctly.
181 # If $xntpdflags != NO, start xntpd.
182 if [ X"${ntpdate}" != X"NO" ]; then
183 echo ' ntpdate'; ntpdate $ntpdate
186 if [ X"${xntpdflags}" != X"NO" ]; then
187 if [ X"${tickadjflags}" != X"NO" ]; then
188 echo 'adjusting kernel for xntpd'; tickadj ${tickadjflags--A}
190 echo 'starting xntpd'; xntpd ${xntpdflags}
193 if [ X"${ntpdate}" != X"NO" -o X"${xntpdflags}" != X"NO" ]; then
194 echo -n 'starting more network daemons:'
197 # $rwhod is imported from /etc/netstart;
198 # if $rwhod is set to something other than NO, rwhod is run.
199 if [ X"${rwhod}" != X"NO" ]; then
200 echo -n ' rwhod'; rwhod
203 echo -n ' printer'; lpd
205 if [ X${nfs_server} = X"YES" -a -r /etc/exports ]; then
206 echo -n ' mountd'; mountd
207 echo -n ' nfsd'; nfsd -u -t 4
210 if [ X"${nfs_client}" != X"NO" ]; then
211 echo -n ' nfsiod'; nfsiod -n 4
214 if [ X"${amdflags}" != X"NO" ]; then
215 echo -n ' amd'; amd ${amdflags}
218 # $sendmail_flags is imported from /etc/netstart;
219 # if $sendmail_flags is something other than NO, sendmail is run.
220 if [ X"${sendmail_flags}" != X"NO" -a -r /etc/sendmail.cf ]; then
221 echo -n ' sendmail'; sendmail ${sendmail_flags}
224 echo -n ' inetd'; inetd
227 mount -a -t nfs >/dev/null 2>&1 & # XXX shouldn't need background
229 # if [ -x /usr/libexec/xtend ]; then
230 # echo -n ' xtend'; /usr/libexec/xtend
233 # Make shared lib searching a little faster. Leave /usr/lib first if you
234 # add your own entries or you may come to grief.
235 if [ -x /sbin/ldconfig ]; then
237 if [ -d /usr/X11R6/lib ]; then _LDC="${_LDC} /usr/X11R6/lib" ; fi
238 if [ -d /usr/X386/lib ]; then _LDC="${_LDC} /usr/X386/lib" ; fi
239 if [ -d /usr/local/lib ]; then _LDC="${_LDC} /usr/local/lib" ; fi
240 if [ -d /usr/gnu/lib ]; then _LDC="${_LDC} /usr/gnu/lib" ; fi
241 echo 'setting ldconfig path:' ${_LDC}