Ghostscript issue

Discussion in 'Mac OS X Server, Xserve, and Networking' started by AusS2000, Apr 15, 2016.

  1. AusS2000 macrumors newbie

    Joined:
    Nov 12, 2009
    #1
    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.
     
  2. superscape macrumors 6502a

    superscape

    Joined:
    Feb 12, 2008
    Location:
    East Riding of Yorkshire, UK
    #2
    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...
     
  3. AusS2000 thread starter macrumors newbie

    Joined:
    Nov 12, 2009
    #3
    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.
     
  4. superscape macrumors 6502a

    superscape

    Joined:
    Feb 12, 2008
    Location:
    East Riding of Yorkshire, UK
    #4
    Oooof. I'm afraid I'm not familiar with Terascript so I can't be much help.
     
  5. satcomer macrumors 603

    satcomer

    Joined:
    Feb 19, 2008
    Location:
    The Finger Lakes Region
    #5
    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?
     
  6. AusS2000 thread starter macrumors newbie

    Joined:
    Nov 12, 2009
    #6
    I'm not familiar with 'System Protection'. I will look into it. Thanks.
     
  7. satcomer macrumors 603

    satcomer

    Joined:
    Feb 19, 2008
    Location:
    The Finger Lakes Region
    #7
  8. AusS2000 thread starter macrumors newbie

    Joined:
    Nov 12, 2009
    #8
  9. chabig macrumors 68040

    Joined:
    Sep 6, 2002
    #9
    Could you use OS image tools to do the PDF to JPG conversion..
     
  10. AusS2000 thread starter macrumors newbie

    Joined:
    Nov 12, 2009
    #10
    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.
     

Share This Page