Penguin
Note: You are viewing an old revision of this page. View the current version.

AlastairPorter is trying to write some RedHat init.d scripts for the MetaNet.

  1. /bin/sh

#

  1. Etud startup script for the Ethernet over UDP daemon

#

  1. Written by Daniel Lawson <daniel@meta.net.nz>
  2. Modified for Red Hat by Alastair Porter <alastair@wlug.org.nz>

# #

  1. Source function library.

. /etc/rc.d/init.d/functions

ETUDCONF=/usr/local/etc/etud.conf DAEMON=/usr/local/sbin/Etud

  1. ETUDCONF=/etc/wandclients/etud.conf
  2. 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

  1. Check for the Etud configuration file

if [ ! -f ${ETUDCONF}?; then

echo Could not find etud configuration file exit

fi

  1. Parameter defaults

IFNAME=wan0 CTRLFILE=/var/run/Etud.ctrl PIDFILE=/var/run/Etud.pid

  1. 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 0 ARGS="-f $ETUDCONF -p $PIDFILE"

set -e

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;

}

  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 ;;

stop)

echo -n "Stopping Etud " ifdown ${IFNAME}

  1. killproc Etud
  2. 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}

  1. killproc Etud
  2. 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

lib/BlockParser.php:505: Notice: Undefined property: _tight_top