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
67 # Function to dynamically start a system service
69 # First check if this service is disabled at the boot monitor.
70 if disabled $service; then return; fi
72 # Service is not disabled. Try to bring it up.
74 service $opt up /usr/sbin/$service "$@"
78 DAEMONS=/etc/rc.daemons
82 # Select console font.
83 test -f /etc/font && loadfont /etc/font </dev/console
86 rm -rf /tmp/. /usr/run/. /usr/spool/lpd/. /usr/spool/locks/.
88 # Start servers and drivers set at the boot monitor.
89 echo -n "Starting services:"
90 upopt -n random -dev /dev/random -devstyle STYLE_DEVA -period 3HZ
92 # load random number generator
93 if [ -f $RANDOM_FILE ]
95 cat < $RANDOM_FILE >/dev/random
96 # overwrite $RANDOM_FILE. We don't want to use this data again
97 dd if=/dev/random of=$RANDOM_FILE bs=1024 count=1 2> /dev/null
100 # start only network drivers that are in use
101 for driver in lance rtl8139 rtl8169 fxp e1000 dpeth dp8390 orinoco atl2 dec21140A
103 if grep " $driver " /etc/inet.conf > /dev/null 2>&1
105 eval arg=\$${driver}_arg
106 if [ ! -z "$arg" ]; then arg="-args \"$arg\""; fi
107 eval up $driver $arg -period 5HZ
110 up inet -script /etc/rs.inet -dev /dev/ip -devstyle STYLE_CLONE
111 upopt -n printer -dev /dev/lp -period 10HZ
115 # Network initialization.
116 (: </dev/tcp) 2>/dev/null && net=t # Is there a TCP/IP server?
118 echo -n "Starting daemons:"
121 # Ugly error message when starting cron from CD.
122 # (and cron unnecessary then so..)
126 rm -f /var/log || true
127 ln -s /tmp/log /var/log || true
130 # syslogd has not been started yet
131 rm -f /var/run/syslogd.pid
137 if [ -f /etc/rc.net ]
139 # Let a customized TCP/IP initialization script figure it out.
142 # Standard network daemons.
143 echo -n "Starting networking:"
144 if grep -s 'psip0.*default' /etc/inet.conf
145 then ifconfig -h 10.0.0.1
153 # The last daemon has been started, so close the list:
160 # Get the nodename from the DNS and set it.
162 intr -t 20 hostaddr -h
166 # Recover files being edited when the system crashed.
167 test -f /usr/bin/elvprsv && elvprsv /usr/tmp/elv*
169 # Run the daily cleanup on systems that are not on at night.
170 test -f /usr/etc/daily && sh /usr/etc/daily boot &
174 # Save random data, if /usr is mounted rw.
175 if grep ' \/usr .*rw' /etc/mtab >/dev/null
177 if dd if=/dev/random of=$RANDOM_FILE.new bs=1024 count=1 2>/dev/null
179 mv $RANDOM_FILE.new $RANDOM_FILE
181 echo 'Failed to save random data.'
186 d=/usr/local/etc/rc.d
187 # Let packages run their own scripts
191 echo -n "Local packages ($action): "