All pastes #254676 Raw Edit

Miscellany

public text v1 · immutable
#254676 ·published 2006-11-22 03:10 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) && kill -HUP $TCODE_PID
        fi
    done
}