#!/bin/bash # # ladvd Startup script for the cdp/lldp sender # # chkconfig: - 85 15 # description: ladvd uses cdp / lldp frames to inform switches \ # about connected hosts, which simplifies ethernet \ # switch management. # processname: ladvd # pidfile: /var/run/ladvd.pid # ### BEGIN INIT INFO # Provides: ladvd # Required-Start: $local_fs $network # Required-Stop: $local_fs $network # Short-Description: start and stop cdp/lldp sender # Description: ladvd uses cdp / lldp frames to inform switches # about connected hosts, which simplifies ethernet # switch management. ### END INIT INFO # Source function library. . /etc/rc.d/init.d/functions [ -f /etc/sysconfig/network ] && . /etc/sysconfig/network [ "${NETWORKING}" = "yes" ] || exit 0 [ -r /etc/sysconfig/ladvd ] && . /etc/sysconfig/ladvd ARGS="" [ "$CDP" != "yes" ] && [ "$LLDP" != "yes" ] && \ echo "Need at least CDP or LDP activated" && \ exit 1 [ "$CDP" == "yes" ] && ARGS=$ARGS" -c" [ "$LLDP" == "yes" ] && ARGS=$ARGS" -l" [ "$MGMT" != "" ] && ARGS=$ARGS" -m $MGMT" [ "$COUNTRY" != "" ] && ARGS=$ARGS" -C $COUNTRY" [ "$LOCATION" != "" ] && ARGS=$ARGS" -L $LOCATION" start() { [ -z "$ARGS" ] && exit 6 echo -n $"Starting ladvd: " daemon /usr/sbin/ladvd $ARGS $LADVDARGS RETVAL=$? echo [ $RETVAL = 0 ] && touch /var/lock/subsys/ladvd return $RETVAL } stop() { echo -n $"Shutting down ladvd: " killproc ladvd RETVAL=$? rm -f /var/lock/subsys/ladvd echo return $RETVAL } [ -f /usr/sbin/ladvd ] || exit 0 # See how we were called. case "$1" in start) start ;; stop) stop ;; force-reload|restart|reload) stop start ;; try-restart|condrestart) [ -e /var/lock/subsys/ladvd ] && (stop; start) ;; status) status ladvd RETVAL=$? ;; *) echo $"Usage: $0 {start|stop|status|restart|reload|condrestart}" exit 3 esac exit $RETVAL