monit-general
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: restarting ffmpeg process


From: Weedy
Subject: Re: restarting ffmpeg process
Date: Wed, 07 May 2014 02:09:16 -0400
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.5.0

On 06/05/14 06:03 PM, Anthony Griffiths wrote:
> 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:
> *long-ffmpeg-command &*
> *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
> variations the script still does not create a pid file.
> 
> in monitrc I have:
> *check process stream with pidfile /var/run/stream.pid*
> *       start = "/usr/bin /root/start-stream.sh"*
> and monit starts without any complaints

I... 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"



reply via email to

[Prev in Thread] Current Thread [Next in Thread]