All pastes #254677 Raw Edit

Untitled

public text v1 · immutable
#254677 ·published 2006-11-22 03:12 UTC
rendered paste body
#!/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 > /dev/null 2>&1) && kill -HUP $TCODE_PID
        fi
    done
}