Differences between version 6 and predecessor to the previous major change of RedHatMetaNetScripts.
Other diffs: Previous Revision, Previous Author, or view the Annotated Edit History
Newer page: | version 6 | Last edited on Wednesday, February 16, 2005 4:03:27 pm | by AristotlePagaltzis | Revert |
Older page: | version 3 | Last edited on Sunday, August 31, 2003 3:07:42 pm | by CraigBox | Revert |
@@ -1,103 +1,202 @@
-
AlastairPorter is trying to write some RedHat init.d scripts for the MetaNet.
+AlastairPorter is trying to write some RedHat init.d scripts for the MetaNet.
-
#!/bin/sh
- #
- # Etud startup script for the Ethernet over UDP daemon
- #
- # Written by Daniel Lawson <daniel@meta.net.nz>
- # Modified for Red Hat by Alastair Porter <alastair@wlug.org.nz>
- #
- #
- # Source function library.
- . /etc/rc.d/init.d/functions
+<verbatim>
+
#!/bin/sh
+#
+# Etud startup script for the Ethernet over UDP daemon
+#
+# Written by Daniel Lawson <daniel@meta.net.nz>
+# Modified for Red Hat by Alastair Porter <alastair@wlug.org.nz>
+#
+#
+# Source function library.
+. /etc/rc.d/init.d/functions
-
ETUDCONF=/usr/local/etc/etud.conf
- DAEMON=/usr/local/sbin/Etud
- #ETUDCONF=/etc/wandclients/etud.conf
- #DAEMON=/usr/sbin/Etud
- PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
- NAME=Etud
- DESC="EtherneT over Udp Daemon"
- IP=/bin/ip
+ETUDCONF=/usr/local/etc/etud.conf
+DAEMON=/usr/local/sbin/Etud
+#ETUDCONF=/etc/wandclients/etud.conf
+#DAEMON=/usr/sbin/Etud
+PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
+NAME=Etud
+DESC="EtherneT over Udp Daemon"
+IP=/bin/ip
-
# Check for the Etud configuration file
- if [
[ ! -f ${ETUDCONF} ]; then
-
echo Could not find etud configuration file
-
exit
- fi
+# Check for the Etud configuration file
+if [ ! -f ${ETUDCONF} ]; then
+
echo Could not find etud configuration file
+
exit
+fi
-
# Parameter defaults
- IFNAME=wan0
- CTRLFILE=/var/run/Etud.ctrl
- PIDFILE=/var/run/Etud.pid
- # Retrieve the real values from the config file if they exist
- while read parameter value
- do
-
if [
[ "$parameter" == "pidfile" ]; then
-
PIDFILE=`echo "$value" | tr -d '"'`
-
elif [
[ "$parameter" == "ctrlfile" ]; then
-
CTRLFILE=`echo "$value" | tr -d '"'`
-
elif [
[ "$parameter" == "ifname" ]; then
-
IFNAME=`echo "$value" | tr -d '"'`
-
fi
- done < $ETUDCONF
+# Parameter defaults
+IFNAME=wan0
+CTRLFILE=/var/run/Etud.ctrl
+PIDFILE=/var/run/Etud.pid
+# Retrieve the real values from the config file if they exist
+while read parameter value
+do
+ if [ "$parameter" == "pidfile" ]; then
+
PIDFILE=`echo "$value" | tr -d '"'`
+
elif [ "$parameter" == "ctrlfile" ]; then
+
CTRLFILE=`echo "$value" | tr -d '"'`
+ elif [ "$parameter" == "ifname" ]; then
+
IFNAME=`echo "$value" | tr -d '"'`
+ fi
+done < $ETUDCONF
-
test -x $DAEMON || exit
- ARGS="-f $ETUDCONF -p $PIDFILE"
+test -x $DAEMON || exit
+ARGS="-f $ETUDCONF -p $PIDFILE"
-
set -e
+set -e
-
case "$1" in
- start)
- echo -n "Starting Etud"
- [
[ -e $CTRLFILE ] && {
-
echo ""
-
echo -n "Control file exists, checking to see if Etud lives? "
+case "$1" in
+start)
+echo -n "Starting Etud"
+ [ -e $CTRLFILE ] && {
+
echo ""
+
echo -n "Control file exists, checking to see if Etud lives? "
- [
[ -e ${PIDFILE} ] || {
-
echo ""
-
echo "No pidfile present, exiting"
-
exit 1;
-
}
-
# check that the pid in the pid file
- [
[ x`cat ${PIDFILE}` == x`pidof ${NAME}` ] && {
-
echo "... yes, aborting"
-
exit 1;
-
} || {
-
echo "... no, removing"
-
\rm ${CTRLFILE}
-
}
+
[ -e ${PIDFILE} ] || {
+
echo ""
+
echo "No pidfile present, exiting"
+
exit 1;
+
}
+
# check that the pid in the pid file
+
[ x`cat ${PIDFILE}` == x`pidof ${NAME}` ] && {
+
echo "... yes, aborting"
+
exit 1;
+
} || {
+
echo "... no, removing"
+
\rm ${CTRLFILE}
+
}
-
}
+
}
-
daemon $DAEMON $ARGS
-
ifdown ${IFNAME}
-
ifup ${IFNAME}
-
echo
-
;;
+
daemon $DAEMON $ARGS
+ ifdown ${IFNAME}
+ ifup ${IFNAME}
+ echo
+ ;;
-
stop)
-
echo -n "Stopping Etud "
-
ifdown ${IFNAME}
- # killproc Etud
- # that should work (I think), but it doesn't... so:
-
kill `cat /var/run/Etud.pid`
-
echo
-
;;
+stop)
+ echo -n "Stopping Etud "
+ ifdown ${IFNAME}
+# killproc Etud
+# that should work (I think), but it doesn't... so:
+ kill `cat /var/run/Etud.pid`
+ echo
+ ;;
-
restart|force-reload)
-
echo -n "Restarting $NAME"
-
ifdown ${IFNAME}
- # killproc Etud
- # again...
-
kill `cat /var/run/Etud.pid`
-
sleep 1
-
daemon $DAEMON $ARGS
-
ifup ${IFNAME}
-
echo
-
;;
- *)
-
echo "Usage: $0 {start|stop|restart|force-reload}" >&2
-
;;
+restart|force-reload)
+ echo -n "Restarting $NAME"
+ ifdown ${IFNAME}
+# killproc Etud
+# again...
+ kill `cat /var/run/Etud.pid`
+ sleep 1
+ daemon $DAEMON $ARGS
+ ifup ${IFNAME}
+ echo
+ ;;
+*)
+ echo "Usage: $0 {start|stop|restart|force-reload}" >&2
+ ;;
-
esac
+esac
+</verbatim>
+
+Or here's one by [GerwinVanDeSteeg] which seems to work for Fedora Core 3.
+
+<tt>/etc/sysconfig/wand</tt>:
+ <verbatim>
+ # Configuration for the wandd daemon for the MetaNet
+ # http://www.wlug.org.nz/MetaNet
+
+ EPORT=22222
+ WPORT=44444
+ SERVER=<the name of the server specified in wand.conf goes here>
+ WANIF=wan0
+ </verbatim>
+
+<tt>/etc/init.d/wand</tt>:
+ <verbatim>
+ #! /bin/sh
+ #
+ # wand
+ #
+ # chkconfig: - 21 79
+ # description: wand provides access to the MetaNet
+ #
+
+ # Source function library.
+ . /etc/init.d/functions
+
+ if [ ! -f /etc/sysconfig/network ]; then
+ exit
+ fi
+
+ if [ ! -f /etc/sysconfig/wand ]; then
+ exit
+ fi
+
+ . /etc/sysconfig/network
+ . /etc/sysconfig/wand
+
+ ETUD=/usr/local/sbin/Etud
+ ETUDCTL=/usr/local/sbin/Etudctl
+ WAND=/usr/local/sbin/wand
+
+ start()
+ {
+ echo -n $"Starting Etud: "
+ daemon $ETUD -l $EPORT -p /var/run/Etud.pid
+ [ "$?" -eq 0 ] && echo_success || echo_failure
+ echo
+ echo -n $"Bringing up interface $WANIF: "
+ ifup $WANIF
+ [ "$?" -eq 0 ] && echo_success || echo_failure
+ echo
+ echo -n $"Starting wand: "
+ daemon $WAND -i $SERVER -l $WPORT
+ [ "$?" -eq 0 ] && echo_success || echo_failure
+ echo
+ service zebra start
+ service bgpd start
+ }
+
+ stop()
+ {
+ service bgpd stop
+ service zebra stop
+ echo -n $"Shutting down wand: "
+ killall wand
+ [ "$?" -eq 0 ] && echo_success || echo_failure
+ echo
+ echo -n $"Shutting down Etud: "
+ killall Etud
+ [ "$?" -eq 0 ] && echo_success || echo_failure
+ echo
+ }
+ case $1 in
+ start)
+ start
+ ;;
+ stop)
+ stop
+ ;;
+ restart)
+ stop
+ start
+ ;;
+ status)
+ service bgpd status
+ service zebra status
+ status $ETUD
+ $ETUDCTL -l
+ status $WANDD
+ ip route | grep zebra
+ ;;
+ *)
+ echo $"Usage: $prog {start|stop|restart|status}"
+ exit 1
+ esac
+ </verbatim>