#!/bin/sh # # chkconfig: 35 97 3 # description: start/stop iperf servers for UDP and TCP on Red Hat Linux # # Eric Myers - 29 July 2003 # @(#) $Id: iperf,v 1.6 2005/07/28 14:01:48 myers Exp myers $ ###################################################################### # Source function library. . /etc/rc.d/init.d/functions # Additional path locations to search PATH=$HOME/bin:/usr/local/sbin:$PATH export PATH # Defaults LOGFILE=/var/log/iperf-daemon.log LOCK=/var/lock/subsys/iperf TCPARGS= UDPARGS= # If there are any config options... if [ -f /etc/sysconfig/iperf ]; then . /etc/sysconfig/iperf else if [ -f $HOME/etc/iperf.cfg ]; then . $HOME/etc/iperf.cfg fi fi # See how we are called. case "$1" in start) echo -n "Starting iperf daemons: " ( iperf -D -s $TCPARGS ; iperf -D -s -u $UDPARGS ) \ >> $LOGFILE && success || failure RC=$? echo [ $RC -eq 0 ] && touch $LOCK exit $RC ;; stop) echo -n "Stopping iperf daemons: " killproc iperf RC=$? echo [ $RC -eq 0 ] && rm -f $LOCK exit $RC ;; restart) $0 stop $0 start exit $? ;; status) status iperf ;; *) echo "Usage: iperf {start|stop|restart|status}" exit 1 esac ##