L
L
Lexaz2017-04-11 12:35:14
linux
Lexaz, 2017-04-11 12:35:14

How to automatically restart the process after stopping the recording in the log file?

There is a FFMPEG process that writes to the log during its execution. After the source disappears, the process hangs and is not deleted. The log accordingly ceases to be written. Help me write a script that would track changes in the log and restart the process when recording stops.
Ps. there is another option to monitor an open port
via telnet or monitor the output of rtmpdump

Answer the question

In order to leave comments, you need to log in

1 answer(s)
X
xibir, 2017-04-11
@Lexaztost

#!/bin/bash
log=имя_лог_файла
while((`date +%s` - `date +%s -r $log` > 20)); do # если текущее время и время изменения лога больше 20 секунд
   # перезапускаем ffmpeg
   sleep 5 # проверяем каждые 5 секунд
done

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question