From owner-freebsd-questions@FreeBSD.ORG Mon Dec 17 07:54:54 2007 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5EE4D16A419 for ; Mon, 17 Dec 2007 07:54:54 +0000 (UTC) (envelope-from keramida@ceid.upatras.gr) Received: from igloo.linux.gr (igloo.linux.gr [62.1.205.36]) by mx1.freebsd.org (Postfix) with ESMTP id E178613C457 for ; Mon, 17 Dec 2007 07:54:53 +0000 (UTC) (envelope-from keramida@ceid.upatras.gr) Received: from kobe.laptop (dialup120.ach.sch.gr [81.186.70.120]) (authenticated bits=128) by igloo.linux.gr (8.14.1/8.14.1/Debian-9) with ESMTP id lBH7sVcN004108 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT); Mon, 17 Dec 2007 09:54:43 +0200 Received: from kobe.laptop (kobe.laptop [127.0.0.1]) by kobe.laptop (8.14.2/8.14.2) with ESMTP id lBH7sSot002522; Mon, 17 Dec 2007 09:54:28 +0200 (EET) (envelope-from keramida@ceid.upatras.gr) Received: (from keramida@localhost) by kobe.laptop (8.14.2/8.14.2/Submit) id lBH7sPBr002521; Mon, 17 Dec 2007 09:54:25 +0200 (EET) (envelope-from keramida@ceid.upatras.gr) Date: Mon, 17 Dec 2007 09:54:25 +0200 From: Giorgos Keramidas To: David Goodnature Message-ID: <20071217075424.GB2398@kobe.laptop> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Hellug-MailScanner: Found to be clean X-Hellug-MailScanner-SpamCheck: not spam, SpamAssassin (not cached, score=-3.951, required 5, autolearn=not spam, ALL_TRUSTED -1.80, AWL 0.45, BAYES_00 -2.60) X-Hellug-MailScanner-From: keramida@ceid.upatras.gr X-Spam-Status: No Cc: freebsd-questions@freebsd.org Subject: Re: Cannot get Script to Run Via Crontab X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Dec 2007 07:54:54 -0000 On 2007-12-16 19:10, David Goodnature 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: $?";