Eric on 24 Aug 2008 14:52:52 -0700


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: [PLUG] Why does it produce a silent error when run from crontab?


Casey:

crontab jobs run with what I call a "stunted" environment... there is 
only a very rudimentary path and little else.  I'm not sure where it 
starts in the directory tree but always cd to where you want to be 
running the script first thing.  Also, they start executing under 
/bin/sh and not bash. (You're right to have #!/bin/bash as the first 
line of your script.).  Check other environment dependencies for your 
programs if that does not solve the problem.

HTH

Eric


Casey Bralla wrote:
> I've got a small batch program that creates a nifty near-realtime view of the
> earth with animated cloud cover (http://www.nerdworld.org/nerdspace.html)
> that **used** to work, but now doesn't on my Debian 4 server.
>
> I can run the program just fine from a command prompt, but it fails in a very
> strange way when run from crontab.
>
> The program has to do some image manipulations, and to do so it
> calls "jpegtopnm" (part of "netpbm") to convert some jpg files into pnm
> format.
>
> Oddly, I can run the conversion script from a bash shell prompt without any
> trouble, but the program bombs weirdly if run from crontab.   When it bombs,
> it doesn't halt or give any kind of error message;  but jpegtopnm just
> creates a pnm file of zero length.
>
>
> So, to summarize:
>
> When jpegtopbm runs in a script started from command prompt, it runs fine.
> But when it runs in the same script started by crontab, it bombs silently
> without creating the pnm image file.
>
>
>
>
>
> Here's an abbreviated version of the script file:
>
> #!/bin/bash
>
> # Create globe images with xplanet.  Create xplanet00.jpg
> /usr/bin/xplanet -body earth -num_times 1 -verbosity 1 -config
> xplanet00.cfg -latitude 39.81 -longitude -75.90 -geometry 1003x752 -starfreq
> 0 -projection orthographic -output xplanet00.jpg
>
> # Convert to intermediate format "pnm"
> /usr/bin/jpegtopnm -verbose xplanet00.jpg>  xplanet00.pnm
> # (This is the line that does not work in batch mode)
>
>
>
>
>
>
> The crontab line looks very normal:
> 0,15,30,45 * * * *       root   /path/create.xplanet.images
>
>
>
>
>
> Anybody have any suggestions of where to explore troubleshooting this problem?
>
> All my error logs are clean.  Nothing looks amiss, except that it doesn't
> work.<sigh>
>
>
>    

-- 
#  Eric Lucas
#
#                "Oh, I have slipped the surly bond of earth
#                 And danced the skies on laughter-silvered wings...
#                                        -- John Gillespie Magee Jr

___________________________________________________________________________
Philadelphia Linux Users Group         --        http://www.phillylinux.org
Announcements - http://lists.phillylinux.org/mailman/listinfo/plug-announce
General Discussion  --   http://lists.phillylinux.org/mailman/listinfo/plug