Contents of /trunk/magellan-initscripts/etc/rc.d/init.d/network
Parent Directory | Revision Log
Revision 20 -
(show annotations)
(download)
Fri Dec 31 18:41:21 2004 UTC (19 years, 8 months ago) by niro
File size: 3070 byte(s)
Fri Dec 31 18:41:21 2004 UTC (19 years, 8 months ago) by niro
File size: 3070 byte(s)
fixed shutdown of the dhcp daemon
1 | #!/bin/bash |
2 | |
3 | #%rlevels: 0:k 1:k 2:k 3:s 4:s 5:s 6:k |
4 | #%start: 20 |
5 | #%stop: 80 |
6 | |
7 | #deps |
8 | #%needs: |
9 | #%before: |
10 | #%after: |
11 | |
12 | source /etc/sysconfig/rc |
13 | source ${rc_functions} |
14 | |
15 | checkconfig() { |
16 | if [ -z "${NETWORKING}" ] |
17 | then |
18 | echo "NETWORKING missing in net.${interface}, aborted" |
19 | exit 1 |
20 | fi |
21 | |
22 | case "${NETWORKING}" in |
23 | static) |
24 | if [ -z "${IP}" ] |
25 | then |
26 | echo "IP missing in net.${interface}, aborted" |
27 | exit 1 |
28 | fi |
29 | |
30 | if [ -z "${NETMASK}" ] |
31 | then |
32 | echo -n "NETMASK missing in net.${interface}, " |
33 | echo "using 255.255.255.0" |
34 | NETMASK=255.255.255.0 |
35 | fi |
36 | |
37 | if [ -z "${BROADCAST}" ] |
38 | then |
39 | echo -n "BROADCAST missing in net.${interface}, " |
40 | echo "using default address" |
41 | fi |
42 | ;; |
43 | |
44 | dhcp) |
45 | if [ -z "${DHCP_PROG}" ] |
46 | then |
47 | echo "DHCP_PROG missing in net.${interface}, aborted" |
48 | exit 1 |
49 | fi |
50 | ;; |
51 | |
52 | esac |
53 | } |
54 | |
55 | |
56 | case "$1" in |
57 | start) |
58 | for file in $(grep -il "ONBOOT=\"yes\"" ${network_settings}/net.*) |
59 | do |
60 | interface=$(basename ${file} | sed s/net.//) |
61 | case "${interface}" in |
62 | *~) ;; |
63 | *) |
64 | source ${network_settings}/net.${interface} || exit 1 |
65 | checkconfig |
66 | case "${NETWORKING}" in |
67 | dhcp) |
68 | echo -e ${COLOREDSTAR}"Bringing up interface ${COLBLUE}${interface}${COLDEFAULT} ..." |
69 | ${CURS_UP} |
70 | ${SET_WWCOL} |
71 | echo "[DHCP]" |
72 | loadproc ${DHCP_PROG} ${DHCP_START} |
73 | ;; |
74 | static) |
75 | echo -e ${COLOREDSTAR}"Bringing up interface ${COLBLUE}${interface}${COLDEFAULT} ..." |
76 | ${CURS_UP} |
77 | ${SET_WWCOL} |
78 | echo "[STATIC]" |
79 | ifconfig ${interface} ${IP} netmask ${NETMASK} broadcast ${BROADCAST} |
80 | evaluate_retval |
81 | ;; |
82 | esac |
83 | ;; |
84 | esac |
85 | done |
86 | |
87 | if [ -n "${GATEWAY}" -a -n "${GATEWAY_IF}" ] |
88 | then |
89 | echo -e ${COLOREDSTAR}"Setting up default gateway ..." |
90 | route add default gateway ${GATEWAY} metric 1 \ |
91 | dev ${GATEWAY_IF} |
92 | evaluate_retval |
93 | fi |
94 | |
95 | update_svcstatus $1 |
96 | splash svc_started "$(basename $0)" 0 |
97 | ;; |
98 | |
99 | stop) |
100 | if [ -n "${GATEWAY}" ] |
101 | then |
102 | echo -e ${COLOREDSTAR}"Removing default gateway ..." |
103 | route del -net default |
104 | evaluate_retval |
105 | fi |
106 | |
107 | for file in $(grep -il "ONBOOT=\"yes\"" ${network_settings}/net.*) |
108 | do |
109 | interface=$(basename ${file} | sed s/net.//) |
110 | case "${interface}" in |
111 | *~) ;; |
112 | *) |
113 | #$network_devices/ifdown $interface |
114 | source ${network_settings}/net.${interface} || exit 1 |
115 | checkconfig |
116 | echo -e ${COLOREDSTAR}"Bringing down interface ${COLBLUE}${interface}${COLDEFAULT} ..." |
117 | ifconfig ${interface} down |
118 | evaluate_retval |
119 | |
120 | #shutdown dhcp-daemon |
121 | if [ "${NETWORKING}" == dhcp ] |
122 | then |
123 | my_runlevel="`runlevel | cut -d ' ' -f2`" |
124 | if [ -n "$(pidof ${DHCP_PROG})" ] |
125 | then |
126 | echo -e ${COLOREDSTAR}"Stopping the dhcp-daemon ..." |
127 | ${CURS_UP} |
128 | ${SET_WWCOL} |
129 | echo "[$(basename ${DHCP_PROG})]" |
130 | ${DHCP_PROG} ${DHCP_STOP} |
131 | evaluate_retval |
132 | fi |
133 | fi |
134 | ;; |
135 | esac |
136 | done |
137 | |
138 | update_svcstatus $1 |
139 | splash svc_stopped "$(basename $0)" 0 |
140 | ;; |
141 | |
142 | restart) |
143 | $0 stop |
144 | sleep 1 |
145 | $0 start |
146 | ;; |
147 | |
148 | *) |
149 | echo "Usage: $0 {start|stop|restart}" |
150 | exit 1 |
151 | ;; |
152 | esac |
Properties
Name | Value |
---|---|
svn:executable | * |