1 # /usr/etc/rc - continued system initialization.
3 RANDOM_FILE=/usr/adm/random.dat
4 LOCAL_FILE=/usr/etc/rc.local
10 *) echo >&2 "Usage: $0 start|stop|down"
14 if [ -f "$LOCAL_FILE" ]
15 then . "$LOCAL_FILE" $1
21 for skip in `sysenv disable`
35 # Function to start a daemon, if it exists.
38 test "$1" = tcpd && name="$2"
45 # check if this service is disabled at the boot monitor.
46 if disabled $name; then return; fi
60 # Function to dynamically start a system service
62 # First check if this service is disabled at the boot monitor.
63 if disabled $service; then return; fi
65 # Service is not disabled. Try to bring it up.
67 service up /usr/sbin/$service "$@"
71 DAEMONS=/etc/rc.daemons
75 # Select console font.
76 test -f /etc/font && loadfont /etc/font </dev/console
79 rm -rf /tmp/. /usr/run/. /usr/spool/lpd/. /usr/spool/locks/.
81 # Start servers and drivers set at the boot monitor.
82 echo -n "Starting services:"
83 up random -dev /dev/random -period 3HZ
85 # load random number generator
86 if [ -f $RANDOM_FILE ]
88 cat < $RANDOM_FILE >/dev/random
89 # overwrite $RANDOM_FILE. We don't want to use this data again
90 dd if=/dev/random of=$RANDOM_FILE bs=1024 count=1 2> /dev/null
93 # start only network drivers that are in use
94 for driver in lance rtl8139 fxp dpeth dp8390
96 if grep " $driver " /etc/inet.conf > /dev/null 2>&1
98 eval arg=\$${driver}_arg
99 if [ ! -z "$arg" ]; then arg="-args \"$arg\""; fi
100 eval up $driver $arg -period 5HZ
104 up printer -dev /dev/lp -period 10HZ
107 # Network initialization.
108 (: </dev/tcp) 2>/dev/null && net=t # Is there a TCP/IP server?
110 echo -n "Starting daemons:"
113 # Ugly error message when starting cron from CD.
114 # (and cron unnecessary then so..)
118 rm -f /var/log || true
119 ln -s /tmp/log /var/log || true
122 # syslogd has not been started yet
123 rm -f /var/run/syslogd.pid
129 if [ -f /etc/rc.net ]
131 # Let a customized TCP/IP initialization script figure it out.
134 # Standard network daemons.
135 echo -n "Starting networking:"
136 if grep -s 'psip0.*default' /etc/inet.conf
137 then ifconfig -h 10.0.0.1
144 # The last daemon has been started, so close the list:
151 # Get the nodename from the DNS and set it.
153 intr -t 20 hostaddr -h
157 # Recover files being edited when the system crashed.
158 test -f /usr/bin/elvprsv && elvprsv /usr/tmp/elv*
160 # Run the daily cleanup on systems that are not on at night.
161 test -f /usr/etc/daily && sh /usr/etc/daily boot &
165 # Save random data, if /usr is mounted rw.
166 if grep ' \/usr .*rw' /etc/mtab >/dev/null
168 if dd if=/dev/random of=$RANDOM_FILE.new bs=1024 count=1 2>/dev/null
170 mv $RANDOM_FILE.new $RANDOM_FILE
172 echo 'Failed to save random data.'
177 d=/usr/local/etc/rc.d
178 # Let packages run their own scripts
182 echo -n "Local packages ($action): "