Cron Job scheduling
Posted: 2010-10-02T07:34:11-07:00
I am trying to automate a process by using a Cron job and ImageMagick to adjust a photo at midnight each night.
I am using a php script with the exec commands for imagemagick and if I run the script in a browser it works perfectly. But if I run it through a cron job imagemagick fails to create the image. And I know the cron job is working because the script also sends me an email.
I suspect it has something to do with relative vs. direct paths to the images, but I can't seem to figure it out.
This code works when the script is run manually.
This code doesn't seem to work at all. I just grabbed the path from a php error.
Thanks in advance for any help.
I am using a php script with the exec commands for imagemagick and if I run the script in a browser it works perfectly. But if I run it through a cron job imagemagick fails to create the image. And I know the cron job is working because the script also sends me an email.
I suspect it has something to do with relative vs. direct paths to the images, but I can't seem to figure it out.
This code works when the script is run manually.
Code: Select all
exec("/usr/bin/convert ./large/test.png -resize 55% ./small/test.png");
Code: Select all
exec("/usr/bin/convert /var/www/vhosts/<domain>/httpdocs/large/test.png -resize 55% /var/www/vhosts/<domain>/httpdocs/small/test.png");