Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

AusS2000

macrumors member
Original poster
Nov 12, 2009
33
0
I'm using Yosemite Server (Apache), Terascript , ImageMagick and Ghostscript in a web serving environment. I'm having issues creating JPGs from PDFs from a script.

A bit of background. I have a development server running Lion Server, Apache 2.2, Terascript 6.21, ImageMagick (?.?) and Ghostscript (?.?) and the process works perfectly there. A client uploads a PDF and the combination of a shell script, ImageMagick and Ghostscript successfully creates a JPG.

I've set up the production server with all newer versions of the software (Apache 2.4, Terascript 7, ImageMagick 6.9.3-8, Ghostscript 9.19. I can confirm that when I enter the commands from Terminal it generates a JPG from a PDF successfully:

sudo -u username -p password /opt/local/bin/convert -thumbnail 215x300 /path/to/source.pdf[0] -flatten /path/to/target.jpg

When I generate the same from a script it fails with this error:

4/15/16 1:46:24.983 PM sudo[4723]: wayneirvine : TTY=unknown ; PWD=/Applications/TeraScript Server 7/log_TeraScript_Server_7 ; USER=username ; COMMAND=/opt/local/bin/convert -thumbnail 215x300 /path/to/source.pdf[0] -flatten /path/to/target.jpg

I tried adding the following lines to the sudoers file:

Default:username !requiretty
username ALL=(ALL) NOPASSWD: ALL

Now I get no error, but no JPG either.

Any help from the unix gurus would be appreciated.
 

AusS2000

macrumors member
Original poster
Nov 12, 2009
33
0
Not sure if I can help too much here, but what's calling the command? e.g. is it "exec" from PHP, or something being run by cron etc...

It's an 'External Action' in Terascript. You can call a shell script and pass parameters to it.
I have been told that the action produces a ResultSet that may provide some clues so will try that next.
 

AusS2000

macrumors member
Original poster
Nov 12, 2009
33
0
Maybe some sort of System Protection is in play. Did you make sure you turned it off in your new server before running the scripts?

I'm not familiar with 'System Protection'. I will look into it. Thanks.
 

AusS2000

macrumors member
Original poster
Nov 12, 2009
33
0
Could you use OS image tools to do the PDF to JPG conversion..
I'm not familiar with the OS image tools. Are they command line?

This issue here is not really to get it working, but to gain an understanding of why it is not. A learning exercise.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.