Page 1 of 1

ImageMagick: weird issue when called by a cron job

Posted: 2012-01-23T17:56:09-07:00
by fablau
Hello here,
I am experiencing a weird issue with ImageMagick (vesion 6.7.4-4), in particular with the "convert" command.

While I am logged as root, I am able to make the following simple conversion without any reported error:

Code: Select all

/usr/local/bin/convert source.pdf destination.gif
If I call the exact same command from a cron job run by root, I get the following error:

Code: Select all

sh: gs: command not found
convert: Postscript delegate failed `/my-path-to/source.pdf': No such file or directory @ error/pdf.c/ReadPDFImage/667.
convert: missing an image filename `/my-path-to/destination.gif' @ error/convert.c/ConvertImageCommand/3016.

Any ideas? This is really weird... I mean, if I run the command via shell manually as root it works just fine, but if I call it as a cron job as root it doesn't...

Any suggestions and thoughts are very welcome!

Thank you.

All the best,
Fab.

Re: ImageMagick: weird issue when called by a cron job

Posted: 2012-01-23T18:32:32-07:00
by fmw42
perhaps it is a permissions issue on the file gs or gsc. locate that file (probably /usr/local/bin) and check to see if

-rwxr-xr-x 1 root admin 9240 Nov 30 14:54 gsc

Re: ImageMagick: weird issue when called by a cron job

Posted: 2012-01-24T06:49:48-07:00
by fablau
Thank you for your reply, but permissions look correct:

-rwxr-xr-x 1 root root 16377359 Jan 5 15:43 gs

Any more thoughts?

Re: ImageMagick: weird issue when called by a cron job

Posted: 2012-01-24T07:16:50-07:00
by fablau
Problem solved: I added the following command before invoking convert:

export PATH=/usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin;

and now it works just fine. It is weird though that despite I am invoking "convert" from a cron job acting as the same exact user I am using manually (root) is not finding the path to look into for calling "gs" (which is inside the /usr/local/bin dir).

Thank you anyway for your help.

Best,
Fab.