Dynamic starting of services.
This commit is contained in:
parent
1d60e866c3
commit
61a4e15bb0
43
etc/usr/rc
43
etc/usr/rc
@ -1,5 +1,7 @@
|
|||||||
# /usr/etc/rc - continued system initialization.
|
# /usr/etc/rc - continued system initialization.
|
||||||
|
|
||||||
|
RANDOM_FILE=/usr/adm/random.dat
|
||||||
|
|
||||||
case "$#:$1" in
|
case "$#:$1" in
|
||||||
1:start|1:stop|1:down)
|
1:start|1:stop|1:down)
|
||||||
action=$1
|
action=$1
|
||||||
@ -26,7 +28,31 @@ daemonize()
|
|||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
RANDOM_FILE=/usr/adm/random.dat
|
up()
|
||||||
|
{
|
||||||
|
service=$1
|
||||||
|
args=$2
|
||||||
|
device=$3
|
||||||
|
|
||||||
|
# Function to dynamically start a system service
|
||||||
|
|
||||||
|
# First check if this service is disabled at the boot monitor.
|
||||||
|
ifs="$IFS"; IFS=,
|
||||||
|
for name in `sysenv disable`
|
||||||
|
do
|
||||||
|
if [ "$name" = "$service" ]
|
||||||
|
then return
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
IFS="$ifs"; unset ifs
|
||||||
|
|
||||||
|
# Service is not disabled. Try to bring it up.
|
||||||
|
command="/usr/sbin/$service"
|
||||||
|
if [ ! -z "$args" ]; then command="$command -args \"$args\""; fi
|
||||||
|
if [ ! -z "$device" ]; then command="$command -dev \"$device\""; fi
|
||||||
|
echo -n " $service"
|
||||||
|
eval service up $command
|
||||||
|
}
|
||||||
|
|
||||||
case $action in
|
case $action in
|
||||||
start)
|
start)
|
||||||
@ -44,11 +70,16 @@ start)
|
|||||||
dd if=/dev/random of=$RANDOM_FILE bs=1024 count=1
|
dd if=/dev/random of=$RANDOM_FILE bs=1024 count=1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Start servers.
|
# Start servers and drivers set at the boot monitor.
|
||||||
ifs="$IFS"; IFS=,
|
echo -n "Starting services:"
|
||||||
for server in `sysenv servers`; do daemonize $server; done
|
up rtl8139
|
||||||
IFS="$ifs"; unset ifs
|
up fxp
|
||||||
sleep 1
|
up dpeth
|
||||||
|
up inet
|
||||||
|
up is "arg is leuk"
|
||||||
|
up printer "" /dev/lp
|
||||||
|
up floppy "" /dev/fd0
|
||||||
|
echo .
|
||||||
|
|
||||||
# Network initialization.
|
# Network initialization.
|
||||||
(: </dev/tcp) 2>/dev/null && net=t # Is there a TCP/IP server?
|
(: </dev/tcp) 2>/dev/null && net=t # Is there a TCP/IP server?
|
||||||
|
Loading…
x
Reference in New Issue
Block a user