60 lines
1.2 KiB
Bash
60 lines
1.2 KiB
Bash
|
#!/bin/bash
|
||
|
|
||
|
. /usr/local/bin/asic_status.sh
|
||
|
|
||
|
function debug()
|
||
|
{
|
||
|
/usr/bin/logger $1
|
||
|
/bin/echo `date` "- $1" >> ${DEBUGLOG}
|
||
|
}
|
||
|
|
||
|
start() {
|
||
|
debug "Starting ${SERVICE}$DEV service..."
|
||
|
|
||
|
# On supervisor card, skip starting asic related services here. In wait(),
|
||
|
# wait until the asic is detected by pmon and published via database.
|
||
|
if ! is_chassis_supervisor; then
|
||
|
# start service docker
|
||
|
/usr/bin/${SERVICE}.sh start $DEV
|
||
|
debug "Started ${SERVICE}$DEV service..."
|
||
|
fi
|
||
|
}
|
||
|
|
||
|
wait() {
|
||
|
# On supervisor card, wait for asic to be online before starting the docker.
|
||
|
if is_chassis_supervisor; then
|
||
|
check_asic_status
|
||
|
ASIC_STATUS=$?
|
||
|
|
||
|
# start service docker
|
||
|
if [[ $ASIC_STATUS == 0 ]]; then
|
||
|
/usr/bin/${SERVICE}.sh start $DEV
|
||
|
debug "Started ${SERVICE}$DEV service..."
|
||
|
fi
|
||
|
fi
|
||
|
|
||
|
/usr/bin/${SERVICE}.sh wait $DEV
|
||
|
}
|
||
|
|
||
|
stop() {
|
||
|
debug "Stopping ${SERVICE}$DEV service..."
|
||
|
|
||
|
/usr/bin/${SERVICE}.sh stop $DEV
|
||
|
debug "Stopped ${SERVICE}$DEV service..."
|
||
|
}
|
||
|
|
||
|
DEV=$2
|
||
|
|
||
|
SERVICE="lldp"
|
||
|
DEBUGLOG="/tmp/lldp-debug$DEV.log"
|
||
|
|
||
|
case "$1" in
|
||
|
start|wait|stop)
|
||
|
$1
|
||
|
;;
|
||
|
*)
|
||
|
echo "Usage: $0 {start|wait|stop}"
|
||
|
exit 1
|
||
|
;;
|
||
|
esac
|