I
I
ILoveYAnny2018-05-30 10:24:28
linux
ILoveYAnny, 2018-05-30 10:24:28

How to make a command work through Cron?

Hello, I have a script that crops a video file. The command is executed on the hosting, due to hosting restrictions I cannot install FFMpeg and I use the compiled FFMpeg binaries. I run the script with the command:

/opt/php/5.6/bin/php -f /var/www/public_html/domain.ru/script.php

When I write this command through Putty, everything is fine.
However, through Cron I get the error:
FFmpeg Errors: ["Error while opening decoder for input stream #0:0 : Resource temporarily unavailable"], Command: "-y -ss 00:00:01.000 -i '/var/www/public_html/domain.ru/docs/video.mp4' -vf 'crop=w=640:h=640:x=0:y=0,scale=w=640:h=640,pad=w=640:h=640:x=0:y=0:color=0xFFFFFF' -f mjpeg -vframes 1 '/tmp/INSTAVID_voC1jM'


What can be wrong? After all Cron analog of input of commands in the console?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
P
Pavel, 2018-05-30
@ILoveYAnny

I believe that cron and ssh work from different users, or in different working environments.
An option to add a run as a user, for example:

00 * * * * youuser /opt/php/5.6/bin/php -f /var/www/public_html/domain.ru/script.php

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question