Miscellany
public text v1 · immutable#!/bin/bash
function get_line_count()
{
awk 'END{print NR}' todisc.log
}
check_stall()
{
while ps -p $TCODE_PID >/dev/null; do
lines=$(get_line_count)
sleep 5
newlines=$(get_line_count)
((newlines == lines)) && sleep 30
if ((newlines == lines)); then
echo "transcode appears to be stalled"
echo "We are going to send transcode a HUP and hope for the best"
sleep 5
$(kill -0 $TCODE_PID) && kill -HUP $TCODE_PID
fi
done
}