Search code examples
ffmpegtimeoutstart-stop-daemon

Start service with start-stop-daemon on Ubuntu 16.04 with timeout


I have /etc/init.d/stream proces with start/stop/restart options. It's run ffmpeg with daemon options taken from /etc/default/stream DAEMON_OPTIONS. Start at background (-b) crate pid (/var/run/stream/stream.pid) etc.

How could I add timeout 60 seconds to be sure that stream will be forcebly stopped if exceed 60 sek. timeout?

Can't run "--exec timeout 60 ffmpeg" because service runs only timeout command.

I'm I missing something or try to use wrong command ?


Solution

  • Thanks to @TalkVideo Network I've changed DAEMON variable to:

    DAEMON=" /usr/bin/timeout $TIMEOUT /usr/bin/ffmpeg "
    

    and service run ok !