0
votes

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 ?

2

2 Answers

1
votes

For starters, try using quotes in your command. You may need to escape them with backslashes like so: \'

It sounds like what you are saying is that the service is only --exec(ing) this command:

"timeout"

When the command you really want is: "timeout 60 ffmpeg"

So try these: "--exec 'timeout 60 ffmpeg'"

or: '--exec "timeout 60 ffmpeg"'

or possibly: --exec \"timeout 60 ffmpeg\""

You should be able to --exec any command, regardless of how many words it has, or command line options. You should also be able to --exec multiple commands separated by semicolons.

0
votes

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

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

and service run ok !