Re: Cannot get Script to Run Via Crontab
Giorgos Keramidas writes: The lines from my script that are causing the problem are: my $scomd = /usr/local/bin/ps2pdf -dPDFSETTINGS=/prepress -dProcessColorModel=/DeviceGray -dAutoRotatePages=/PageByPage -dDownsampleMonoImages=true -dMonoImageDownsampleType=/Average -dMonoImageDownsampleThreshold=1.5 -dMonoImageResolution=600 .$inpath.$cur_ps_files[0]. .$outpath.$pdffilename; The cron message to mail/root ends with: exec: ps2pdf12: not found I am assuming that cron cannot find a path or a config file for ghostscript, but I don't have any idea how to fix this problem. Yes. That's what is happenning. The default PATH of cron jobs doesn't include `/usr/local/bin', but you have lots of options: 1) Add it to the crontab file 2) Modify the default path in your Perl script: Allow me to recommend the second, as it will not disturb other cron programs that may be expecting the default path. Robert Huff ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to [EMAIL PROTECTED]
Re: Cannot get Script to Run Via Crontab
On 2007-12-17 07:19, Robert Huff [EMAIL PROTECTED] wrote: Giorgos Keramidas writes: The lines from my script that are causing the problem are: [...] The cron message to mail/root ends with: exec: ps2pdf12: not found I am assuming that cron cannot find a path or a config file for ghostscript, but I don't have any idea how to fix this problem. Yes. That's what is happenning. The default PATH of cron jobs doesn't include `/usr/local/bin', but you have lots of options: 1) Add it to the crontab file 2) Modify the default path in your Perl script: Allow me to recommend the second, as it will not disturb other cron programs that may be expecting the default path. That is a very good point :) ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to [EMAIL PROTECTED]
Re: Cannot get Script to Run Via Crontab
Hi, On 16/12/2007, David Goodnature [EMAIL PROTECTED] wrote: [...] The cron message to mail/root ends with: exec: ps2pdf12: not found I am assuming that cron cannot find a path or a config file for ghostscript, but I don't have any idea how to fix this problem. Any help would be appreciated. When calling scripts from cron you only have a very minimal PATH, something that is /bin:/usr/bin. You have two options: Create a Path in Script yourself, and make sure that this is really passed over to the Environment your commands are executed in. Another option is to exec commands with their full qualified pathname. In this case you don't have to care wether or not the path is set up properly. HTH Christian ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to [EMAIL PROTECTED]
Re: Cannot get Script to Run Via Crontab
Christian Walther wrote: Hi, On 16/12/2007, David Goodnature [EMAIL PROTECTED] wrote: [...] The cron message to mail/root ends with: exec: ps2pdf12: not found I am assuming that cron cannot find a path or a config file for ghostscript, but I don't have any idea how to fix this problem. Any help would be appreciated. When calling scripts from cron you only have a very minimal PATH, something that is /bin:/usr/bin. You have two options: Create a Path in Script yourself, and make sure that this is really passed over to the Environment your commands are executed in. Another option is to exec commands with their full qualified pathname. In this case you don't have to care wether or not the path is set up properly. HTH Christian ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to [EMAIL PROTECTED] It's also possible to define a PATH variable (and other environment variables too, for that matter) in the crontable. Put them at the top of the file, above the actual table. -- Sincerly, Rolf Nielsen ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to [EMAIL PROTECTED]
Re: Cannot get Script to Run Via Crontab
On 2007-12-16 19:10, David Goodnature [EMAIL PROTECTED] wrote: I have a perl script that I can execute from the command line as root. It runs fine. When I try to automate it using the root crontab, the script fails. The lines from my script that are causing the problem are: my $scomd = /usr/local/bin/ps2pdf -dPDFSETTINGS=/prepress -dProcessColorModel=/DeviceGray -dAutoRotatePages=/PageByPage -dDownsampleMonoImages=true -dMonoImageDownsampleType=/Average -dMonoImageDownsampleThreshold=1.5 -dMonoImageResolution=600 .$inpath.$cur_ps_files[0]. .$outpath.$pdffilename; ### create the new .pdf file from the .ps file system($scomd) == 0 or return system $scomd failed: $?; The cron message to mail/root ends with: exec: ps2pdf12: not found I am assuming that cron cannot find a path or a config file for ghostscript, but I don't have any idea how to fix this problem. Yes. That's what is happenning. The default PATH of cron jobs doesn't include `/usr/local/bin', but you have lots of options: 1) Add it to the crontab file PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin crontab entries here 2) Modify the default path in your Perl script: $ENV{PATH} = '/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin'; my $scomd = join(' ', ('/usr/local/bin/ps2pdf', '-dPDFSETTINGS=/prepress', '-dProcessColorModel=/DeviceGray', '-dAutoRotatePages=/PageByPage', '-dDownsampleMonoImages=true', '-dMonoImageDownsampleType=/Average', '-dMonoImageDownsampleThreshold=1.5', '-dMonoImageResolution=600' $inpath.$cur_ps_files[0], $outpath.$pdffilename)); system($scomd) == 0 or return system $scomd failed: $?; ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to [EMAIL PROTECTED]