Path Trouble
tc1364
created: 2006-03-02 11:49:50
Unable to run code as a cron job on a Unix box but when running the code from the command line it works fine. The Perl code creates a child process that calls a subroutine that executes a Expect script (non-Perl). Can you please show me how to set up my PATH correctly so that it will run as a cron job? Several things have been tried but with no success.
Re: Path Trouble
created: 2006-03-02 12:17:35

You may well find that PATH is not being set by cron as it is not sourcing in .bashrc or .profile - this is expected and normal behaviour.

You have access to PATH as $ENV{PATH}, which you can set inside your script before you fork. %ENV is available for dumping out for debugging purposes.

--

Oh Lord, won’t you burn me a Knoppix CD ?
My friends all rate Windows, I must disagree.
Your powers of persuasion will set them all free,
So oh Lord, won’t you burn me a Knoppix CD ?
(Missquoting Janis Joplin)

Re^2: Path Trouble
created: 2006-03-02 13:46:48
This was already tried and didn't work. The cron job returns the below. Also, the local to this object code is in my PATH. Your "cron" job on osdsun60 /ossd/tc1364/cscans/bin/start_cscans.pl produced the following output: ld.so.1: dms_start.exp: fatal: libtcl8.3.so: open failed: No such file or direct ory Killed commands will be executed using /usr/bin/sh job 1141324921.a at Thu Mar 2 12:42:01 2006
Re^3: (OT) Path Trouble
created: 2006-03-03 05:42:11

Looks from the diagnostic that the problem might be with $ENV{LD_LIBRARY_PATH} rather than $ENV{PATH}. Which flavour of Unix are you running?

By the way, for readability, could you please put <code> tags around your output.

--

Oh Lord, won’t you burn me a Knoppix CD ?
My friends all rate Windows, I must disagree.
Your powers of persuasion will set them all free,
So oh Lord, won’t you burn me a Knoppix CD ?
(Missquoting Janis Joplin)

Re: Path Trouble
created: 2006-03-02 12:34:29
We use absolute paths in cron scripts. This is sort of for security and mostly to avoid environment issues like the one you seem to be hitting.

Phil

Re^2: Path Trouble
created: 2006-03-02 13:57:45
Yes and it is there. Please see below. # CSCANS Automation 45 12 * * 0-6 /ossd/tc1364/cscans/bin/start_cscans.pl
Re^3: Path Trouble
created: 2006-03-02 14:05:03
I don't mean just in the cron entry. I also mean inside that script, whenever it refers to other scripts, the paths used are all absolute.

Phil

Re^4: Path Trouble
created: 2006-03-02 14:56:50
yes they are. Please see below. $bin = "/ossd/tc1364/cscans/bin"; $dms_start = "$bin/dms_start.exp"; $ess_start = "$bin/ess_start.exp"; $dms_pb = "/sys/extract/menu/west.pl";
Re^4: (OT) Path Trouble
created: 2006-03-04 00:24:54

Part of my job is to babysit cron jobs and I totally agree. The secret to environmental harmony is to be independent of it to the extent possible.

foo($path)
needs to act on a
/full/path
.

perlmonks.org content © perlmonks.org and madizen, philcrow, rinceWind, tc1364

prlmnks.org © 2006 edmund von der burg (eccles & toad)

v 0.03