increase root FS size to 128MB
[minix3.git] / etc / rs.inet
blob5bd9d6b70b25a9cc1486c788b22eec89932909fe
1 #!/bin/sh
3 # Recovery script for INET/lwip. It restarts daemons dependent on it in order
4 # to recover TCP state.
6 kill_by_name()
8 label="$1"
9 pid=`ps ax | grep "$label" | grep -v grep | sed 's,[ ]*\([0-9]*\).*,\1,'`
10 if [ X"$pid" = X ]
11 then
12 return 1 # No such process
14 echo "killing pid $pid for $label"
15 kill -9 $pid
18 daemonize()
20 # Function to start a daemon, if it exists.
21 local IFS=':'
22 local name="$1"
23 test "$1" = tcpd && name="$2"
25 for dir in $PATH
27 if [ -f "$dir/$1" ]
28 then
30 # check if this service is disabled at the boot monitor.
31 if disabled $name; then return; fi
33 echo -n " $name"
34 "$@" &
35 return
37 done
40 disabled()
42 ifs="$IFS"; IFS=,
43 for skip in `sysenv disable`
44 do
45 if [ "$skip" = "$1" ]
46 then
47 IFS="$ifs"; unset ifs
48 return 0
50 done
51 IFS="$ifs"; unset ifs
52 return 1
55 exec > /dev/console
56 echo "Arguments: $@"
58 service down "$1"
59 kill_by_name dhcpd
60 kill_by_name nonamed
61 kill_by_name syslogd
63 # Wait a moment to let daemons clean themselves up
64 sleep 3
65 if [ X`/bin/sysenv lwip` = Xyes ]
66 then
67 service up /service/lwip -script /etc/rs.inet -dev /dev/ip
68 dhcpd --lwip &
69 else
70 service up /service/inet -script /etc/rs.inet -dev /dev/ip
71 daemonize dhcpd
73 daemonize nonamed -L
74 daemonize syslogd
76 # Restart SSH daemon if installed and running
77 if [ -f /usr/pkg/etc/rc.d/sshd ]
78 then
79 /usr/pkg/etc/rc.d/sshd status | grep -v not > /dev/null
80 if [ $? -eq 0 ]
81 then
82 /usr/pkg/etc/rc.d/sshd restart