-
Notifications
You must be signed in to change notification settings - Fork 30
Video box internal bmd streamer monitoring
Mark Van den Borre edited this page Nov 12, 2016
·
2 revisions
Something like this for monitoring the bmd streamer?
#! /bin/bash
SERVICE='bmdstreamer.service'
LOGFILE='/var/log/bmdstreamer.log'
# If we catch anything new in the bmdstreamer log
while inotifywait -e modify $LOGFILE; do
# Check if it's a 'no signal' event being logged
if tail -n1 $LOGFILE | grep 'no signal'; then
echo 'Attention! First time no signal from box. Checking...'
# Avoid spurious 'no signal' events that might occur shortly after a first spurious one. Think on boot or (rarely?) in between.
sleep 5s
# Does another 'no signal' event occur within the next 10 seconds?
inotifywait -e modify $LOGFILE -t 10 | while read path action file; do
if tail -n1 $LOGFILE | grep 'no signal'; then
echo "Asking systemd to please restart $SERVICE"
systemctl restart $SERVICE
fi
done
fi
done