version 7 showing authors affecting page license.
.
Rev |
Author |
# |
Line |
1 |
AlastairPorter |
1 |
AlastairPorter is trying to write some RedHat init.d scripts for the MetaNet. |
7 |
JohnMcPherson |
2 |
|
1 |
AlastairPorter |
3 |
|
5 |
AristotlePagaltzis |
4 |
<verbatim> |
|
|
5 |
#!/bin/sh |
|
|
6 |
# |
|
|
7 |
# Etud startup script for the Ethernet over UDP daemon |
|
|
8 |
# |
|
|
9 |
# Written by Daniel Lawson <daniel@meta.net.nz> |
|
|
10 |
# Modified for Red Hat by Alastair Porter <alastair@wlug.org.nz> |
|
|
11 |
# |
|
|
12 |
# |
|
|
13 |
# Source function library. |
|
|
14 |
. /etc/rc.d/init.d/functions |
1 |
AlastairPorter |
15 |
|
3 |
CraigBox |
16 |
ETUDCONF=/usr/local/etc/etud.conf |
|
|
17 |
DAEMON=/usr/local/sbin/Etud |
|
|
18 |
#ETUDCONF=/etc/wandclients/etud.conf |
|
|
19 |
#DAEMON=/usr/sbin/Etud |
|
|
20 |
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin |
|
|
21 |
NAME=Etud |
|
|
22 |
DESC="EtherneT over Udp Daemon" |
|
|
23 |
IP=/bin/ip |
1 |
AlastairPorter |
24 |
|
3 |
CraigBox |
25 |
# Check for the Etud configuration file |
|
|
26 |
if [ ! -f ${ETUDCONF} ]; then |
|
|
27 |
echo Could not find etud configuration file |
|
|
28 |
exit |
|
|
29 |
fi |
1 |
AlastairPorter |
30 |
|
3 |
CraigBox |
31 |
# Parameter defaults |
|
|
32 |
IFNAME=wan0 |
|
|
33 |
CTRLFILE=/var/run/Etud.ctrl |
|
|
34 |
PIDFILE=/var/run/Etud.pid |
|
|
35 |
# Retrieve the real values from the config file if they exist |
|
|
36 |
while read parameter value |
|
|
37 |
do |
|
|
38 |
if [ "$parameter" == "pidfile" ]; then |
|
|
39 |
PIDFILE=`echo "$value" | tr -d '"'` |
|
|
40 |
elif [ "$parameter" == "ctrlfile" ]; then |
|
|
41 |
CTRLFILE=`echo "$value" | tr -d '"'` |
|
|
42 |
elif [ "$parameter" == "ifname" ]; then |
|
|
43 |
IFNAME=`echo "$value" | tr -d '"'` |
|
|
44 |
fi |
|
|
45 |
done < $ETUDCONF |
1 |
AlastairPorter |
46 |
|
3 |
CraigBox |
47 |
test -x $DAEMON || exit 0 |
|
|
48 |
ARGS="-f $ETUDCONF -p $PIDFILE" |
1 |
AlastairPorter |
49 |
|
3 |
CraigBox |
50 |
set -e |
1 |
AlastairPorter |
51 |
|
3 |
CraigBox |
52 |
case "$1" in |
|
|
53 |
start) |
|
|
54 |
echo -n "Starting Etud" |
|
|
55 |
[ -e $CTRLFILE ] && { |
|
|
56 |
echo "" |
|
|
57 |
echo -n "Control file exists, checking to see if Etud lives? " |
1 |
AlastairPorter |
58 |
|
3 |
CraigBox |
59 |
[ -e ${PIDFILE} ] || { |
|
|
60 |
echo "" |
|
|
61 |
echo "No pidfile present, exiting" |
|
|
62 |
exit 1; |
|
|
63 |
} |
|
|
64 |
# check that the pid in the pid file |
|
|
65 |
[ x`cat ${PIDFILE}` == x`pidof ${NAME}` ] && { |
|
|
66 |
echo "... yes, aborting" |
|
|
67 |
exit 1; |
|
|
68 |
} || { |
|
|
69 |
echo "... no, removing" |
|
|
70 |
\rm ${CTRLFILE} |
|
|
71 |
} |
1 |
AlastairPorter |
72 |
|
3 |
CraigBox |
73 |
} |
1 |
AlastairPorter |
74 |
|
3 |
CraigBox |
75 |
daemon $DAEMON $ARGS |
|
|
76 |
ifdown ${IFNAME} |
|
|
77 |
ifup ${IFNAME} |
|
|
78 |
echo |
|
|
79 |
;; |
1 |
AlastairPorter |
80 |
|
3 |
CraigBox |
81 |
stop) |
|
|
82 |
echo -n "Stopping Etud " |
|
|
83 |
ifdown ${IFNAME} |
|
|
84 |
# killproc Etud |
|
|
85 |
# that should work (I think), but it doesn't... so: |
|
|
86 |
kill `cat /var/run/Etud.pid` |
|
|
87 |
echo |
|
|
88 |
;; |
1 |
AlastairPorter |
89 |
|
3 |
CraigBox |
90 |
restart|force-reload) |
|
|
91 |
echo -n "Restarting $NAME" |
|
|
92 |
ifdown ${IFNAME} |
|
|
93 |
# killproc Etud |
|
|
94 |
# again... |
|
|
95 |
kill `cat /var/run/Etud.pid` |
|
|
96 |
sleep 1 |
|
|
97 |
daemon $DAEMON $ARGS |
|
|
98 |
ifup ${IFNAME} |
|
|
99 |
echo |
|
|
100 |
;; |
|
|
101 |
*) |
|
|
102 |
echo "Usage: $0 {start|stop|restart|force-reload}" >&2 |
|
|
103 |
;; |
1 |
AlastairPorter |
104 |
|
5 |
AristotlePagaltzis |
105 |
esac |
|
|
106 |
</verbatim> |
4 |
GerwinVanDeSteeg |
107 |
|
|
|
108 |
Or here's one by [GerwinVanDeSteeg] which seems to work for Fedora Core 3. |
|
|
109 |
|
5 |
AristotlePagaltzis |
110 |
<tt>/etc/sysconfig/wand</tt>: |
|
|
111 |
<verbatim> |
|
|
112 |
# Configuration for the wandd daemon for the MetaNet |
|
|
113 |
# http://www.wlug.org.nz/MetaNet |
4 |
GerwinVanDeSteeg |
114 |
|
5 |
AristotlePagaltzis |
115 |
EPORT=22222 |
|
|
116 |
WPORT=44444 |
|
|
117 |
SERVER=<the name of the server specified in wand.conf goes here> |
|
|
118 |
WANIF=wan0 |
|
|
119 |
</verbatim> |
4 |
GerwinVanDeSteeg |
120 |
|
5 |
AristotlePagaltzis |
121 |
<tt>/etc/init.d/wand</tt>: |
|
|
122 |
<verbatim> |
|
|
123 |
#! /bin/sh |
|
|
124 |
# |
|
|
125 |
# wand |
|
|
126 |
# |
|
|
127 |
# chkconfig: - 21 79 |
|
|
128 |
# description: wand provides access to the MetaNet |
|
|
129 |
# |
4 |
GerwinVanDeSteeg |
130 |
|
5 |
AristotlePagaltzis |
131 |
# Source function library. |
|
|
132 |
. /etc/init.d/functions |
4 |
GerwinVanDeSteeg |
133 |
|
5 |
AristotlePagaltzis |
134 |
if [ ! -f /etc/sysconfig/network ]; then |
|
|
135 |
exit 0 |
|
|
136 |
fi |
4 |
GerwinVanDeSteeg |
137 |
|
5 |
AristotlePagaltzis |
138 |
if [ ! -f /etc/sysconfig/wand ]; then |
|
|
139 |
exit 0 |
|
|
140 |
fi |
4 |
GerwinVanDeSteeg |
141 |
|
5 |
AristotlePagaltzis |
142 |
. /etc/sysconfig/network |
|
|
143 |
. /etc/sysconfig/wand |
4 |
GerwinVanDeSteeg |
144 |
|
|
|
145 |
ETUD=/usr/local/sbin/Etud |
|
|
146 |
ETUDCTL=/usr/local/sbin/Etudctl |
|
|
147 |
WAND=/usr/local/sbin/wand |
|
|
148 |
|
5 |
AristotlePagaltzis |
149 |
start() |
|
|
150 |
{ |
|
|
151 |
echo -n $"Starting Etud: " |
|
|
152 |
daemon $ETUD -l $EPORT -p /var/run/Etud.pid |
|
|
153 |
[ "$?" -eq 0 ] && echo_success || echo_failure |
|
|
154 |
echo |
|
|
155 |
echo -n $"Bringing up interface $WANIF: " |
|
|
156 |
ifup $WANIF |
|
|
157 |
[ "$?" -eq 0 ] && echo_success || echo_failure |
|
|
158 |
echo |
|
|
159 |
echo -n $"Starting wand: " |
|
|
160 |
daemon $WAND -i $SERVER -l $WPORT |
|
|
161 |
[ "$?" -eq 0 ] && echo_success || echo_failure |
|
|
162 |
echo |
|
|
163 |
service zebra start |
|
|
164 |
service bgpd start |
|
|
165 |
} |
4 |
GerwinVanDeSteeg |
166 |
|
5 |
AristotlePagaltzis |
167 |
stop() |
|
|
168 |
{ |
|
|
169 |
service bgpd stop |
|
|
170 |
service zebra stop |
|
|
171 |
echo -n $"Shutting down wand: " |
|
|
172 |
killall wand |
|
|
173 |
[ "$?" -eq 0 ] && echo_success || echo_failure |
|
|
174 |
echo |
|
|
175 |
echo -n $"Shutting down Etud: " |
|
|
176 |
killall Etud |
|
|
177 |
[ "$?" -eq 0 ] && echo_success || echo_failure |
|
|
178 |
echo |
|
|
179 |
} |
|
|
180 |
case $1 in |
|
|
181 |
start) |
|
|
182 |
start |
|
|
183 |
;; |
|
|
184 |
stop) |
|
|
185 |
stop |
|
|
186 |
;; |
|
|
187 |
restart) |
|
|
188 |
stop |
|
|
189 |
start |
|
|
190 |
;; |
|
|
191 |
status) |
|
|
192 |
service bgpd status |
|
|
193 |
service zebra status |
|
|
194 |
status $ETUD |
|
|
195 |
$ETUDCTL -l |
|
|
196 |
status $WANDD |
|
|
197 |
ip route | grep zebra |
|
|
198 |
;; |
|
|
199 |
*) |
|
|
200 |
echo $"Usage: $prog {start|stop|restart|status}" |
|
|
201 |
exit 1 |
|
|
202 |
esac |
|
|
203 |
</verbatim> |