Skip to content

Instantly share code, notes, and snippets.

@shiwork
Last active December 17, 2015 05:59
Show Gist options
  • Save shiwork/5562220 to your computer and use it in GitHub Desktop.
Save shiwork/5562220 to your computer and use it in GitHub Desktop.
foltiaのエンコードプロセスが12000秒超えている場合に殺す
for i in `ps aux | egrep 'ffmpeg|mplayer' | grep foltia | gawk '{print $2}'`
do
TIME=`ps -o lstart --noheader -p $i`;
START=`date +%s -d "$TIME"`;
NOW=`date +%s`;
PASSTIME=`expr $NOW - $START`;
if [ $PASSTIME -gt 12000 ]; then
kill $i;
echo "kill $i at "`date`;
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment