|
From: | Anthony Griffiths |
Subject: | Re: restarting ffmpeg process |
Date: | Wed, 7 May 2014 12:33:30 +0100 |
thanks for your further help on this weedy. I've succeeded in getting ffmpeg to create a pid file by tagging ' pidof ffmpeg > /var/run/stream.pid' onto the end of the ffmpeg command. I''ve also made sure the permissions are chmod 777 on the pid file however the monit log keeps showing:error : 'stream' process is not runningerror : monit: Start or stop method not defined -- process streamin monitrc I have:check process stream with pidfile /var/run/stream.pidstart = "/bin/sh /root/stream-start.sh"I've made sure that stream-start.sh is chmod 777 as well and the command /bin/sh /root/stream-start.sh in the console starts the ffmpeg process ok.If I start the ffmpeg process manually the monit log shows:info : 'stream' process is running with pid <number>but when the ffmpeg process stops the monit log goes back to:error : 'stream' process is not runningerror : monit: Start or stop method not defined -- process stream
On Wed, May 7, 2014 at 7:09 AM, Weedy <address@hidden> wrote:
On 06/05/14 06:03 PM, Anthony Griffiths wrote:> *long-ffmpeg-command &*
> I wrote a script called stream-start.sh that follows your instructions
> but even though ffmpeg starts fine it does not create a pid file. I
> created this:
> *pid=$!*
> *echo $pid > /var/run/stream.pid*
cat > /root/start-stream.sh
#!/bin/sh
if [ ! -d /var/run/ ]; then mkdir -p /var/run/; fi
if [ -f /var/run/stream.pid ]; then rm /var/run/stream.pid; fi
/usr/bin/ffmpeg -a -lot -of -options &
sleep 3 # make sure it's given enough time to start/die??
echo $(pidof --single-shot ffmpeg) > /var/run/stream.pid
<hit ctrl+d after at least one blank line>
chmod +x /root/start-stream.sh # not really needed
> but this didn't work and and after trawling google and trying a few> *check process stream with pidfile /var/run/stream.pid*
> variations the script still does not create a pid file.
>
> in monitrc I have:
> * start = "/usr/bin /root/start-stream.sh"*
> and monit starts without any complaintsI... what? /usr/bin is a directory. This is probably why $! failed for
you, your not running the file with a specific interpreter. Hard code
the interpreter so this never happens again.
start = "/bin/sh /root/start-stream.sh"
[Prev in Thread] | Current Thread | [Next in Thread] |