[FFmpeg-user] RES: issue with monitoring script
Pedro Daniel Costa
portalnet2 at outlook.com.br
Mon Jul 23 14:25:47 EEST 2018
Hiya robertlazarski
Thxs for your input, it worked like a charm, managed to get te output log to stdout and with tail -f on the output file log i managed to check the issue which was a simple /path location of ffserver and config files
Now everything fully automated, It checks if its running live input, transcoding, if not it fires up ffserver and 1 min after the ffmpeg -I for live transcoding.
-----Mensagem original-----
De: ffmpeg-user [mailto:ffmpeg-user-bounces at ffmpeg.org] Em nome de robertlazarski
Enviada em: sexta-feira, 20 de julho de 2018 21:01
Para: FFmpeg user questions
Assunto: Re: [FFmpeg-user] issue with monitoring script
On Fri, Jul 20, 2018 at 5:37 PM, Pedro Daniel Costa < portalnet2 at outlook.com.br> wrote:
> Hi guys
>
> I need some guidance
>
> I have setup a crontab
>
> To check every minute if a live transcoding channel has stopped.
>
> The script gets pulled via crontab and I can see the instance starting
> up, but then after couple of seconds it gets shutdown,
>
>
> If I run the script manually it starts both ffserver and ffmpeg input
> couple of seconds later and it run for hours/days with no problem..
>
> If I close the terminal where I have executed the script and let the
> crontab execute it, it start and shutdown couple of seconds after
>
> I have correct permissions on the script files and config files..
>
> Here is the ouput of the script
>
> Can someone help me on this as I want to make a monitoring script to
> check all the live transmission transcodings being used
>
>
> And if it crashes or stops I want the crontab to init ffserver and
> ffmpeg shortly after again
>
>
> Here is the output of the script, can someone please tell me what I am
> doing wrong? I use the same similar script to my middlware application
> to check the live multicast transmission and tunners setup from the
> PCI devices..
>
>
> ##########
> # check channel transcoding
> # ffserver channel1.sh
> ##########
>
> #!/bin/bash
>
>
> if ps x |grep -v grep | grep channel1.cfg ; then echo "FFserver runing
> "
> else
> echo "FFserver down"
> ffserver -d -f channel1.cfg
> fi
> sleep 10
> if ps x |grep -v grep | grep channel1.ffm ; then echo "Transcoder
> running "
> else
> echo "transcoder down"
> ffmpeg -i udp://@239.106.3.0:4002
> http://170.80.123.234:8890/channel1.ffm
> fi
>
>
>
>
> Any hints or tips on how to setup a correct check status script will
> be appreciated.
>
>
>
> _______________________________________________
> ffmpeg-user mailing list
> ffmpeg-user at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-user
>
> To unsubscribe, visit link above, or email
> ffmpeg-user-request at ffmpeg.org with subject "unsubscribe".
Try editing your crontab so stdout / stderr go to a log file, to see the specific error - see example below. Also /var/log etc may have cron logs.
Another thing is I would use an absolute path to ffmpeg, you can find the correct path by the command 'which ffmpeg' in the shell .
You may also try putting the process in the background with an '&' at the end of your commands.
sh channel1.sh > /home/username/xxx.log 2>&1 &
You can also get some extra logging via these lines at the top of your file (after '#!/bin/bash') , and an exit on the error line.
set -e
set -x
set -o errexit
Best regards,
Robert
_______________________________________________
ffmpeg-user mailing list
ffmpeg-user at ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-user
To unsubscribe, visit link above, or email ffmpeg-user-request at ffmpeg.org with subject "unsubscribe".
More information about the ffmpeg-user
mailing list