PDA

View Full Version : cron + analog = screendump?


mwhybark
04-01-2002, 08:09 PM
greetings!

I have a set of analog cfgs that I'd like cron to run. I also have a do_all.sh script (see below) that works as desired when run from the CL by hand.

I added this line to cron:

(scheduling info) sh /path/to/do_all.sh

when i run do_all.sh, I get to the directory containing it and type "./do_all.sh"; obviuosly that can't work in a path statement.

Entering "sh /path/to/do_all.sh" at the CL also runs the scripts but writes analog output to the screen, not to the individual directories each file out writes to when run the other way. I assume that this is what happens when cron wakes up and goes off, but, of course, the screen it writes to is uh, theoretical at best.

what to do?

thankee.

xchanyazy
04-01-2002, 11:42 PM
Do you just want a way to capture the output text when running with cron?

Could you do something like "sh /path/to/do_all.sh > blah.txt"?

Sorry if this isn't what you're looking for.

mwhybark
04-02-2002, 11:28 AM
Thanks, greg, but alas no. Although I might head that route if I don't get too much further.

"do_all.sh" is just a collection of one line analog commands:

analog -G +gdom_specific_filename1.cfg
analog -G +gdom_specific_filename2.cfg
...
etc

the *.cfgs contain the output instructions to analog, and the output instructions basically say

"write the report to index.html of dom_specific_directoryname";

so a simple output piping wouldn't do it.

I suppose I'll drop down a step and try running each logreport as a cronjob.

mervTormel
04-02-2002, 12:02 PM
...runs the scripts but writes analog output to the screen, not to the individual directories each file out writes to when run the other way.
sounds like your analog .cfg file has a stdout exception, since it behaves differently when you run it from two different command line refs and you get different results.

if it works when you ./ref the script, and doesn't work when you /fullPathTo/ref the script, i would say your script/.cfg code is dependent on finding itself in the ./ world. you might try cd to your /pathto dir in the script, or use full pathnames in the scripts.

you should strive to get consistent run results before expecting cron to run it unchallenged.

if any of that doesn't help, you'll need to provide some more details about the particulars of the tasks to get further along.

mwhybark
04-02-2002, 12:27 PM
hm...

in the analog cfg files these lines are given explicitly:

LOGFILE /full/path/to/dom_specific_servername.access_log
OUTFILE /full/path/to/stats/dom_specific_servername/index.html

when I run the aggregate script as "sh /ful/path/do_all.sh" it does find the logfile-in data but ignores the outfile instruction and writes it to the screen.

are you suggesting checking analog dcs to see if I need to try including the outfile instruction in the CL ref?

ie

analog -G +gdom_specific_servername.cfg

becomes

analog -G +gdom_specific_servername.cfg > /full/path/to/stats/dom_specific_servername/index.html

(assuming that's the appropriate syntax)

mervTormel
04-02-2002, 12:40 PM
hmm, i don't know what i'm suggesting other than to discover why analog fails to write to OUTFILE; are there any errors? is stderr redirected? perhaps console or syslog?

i don't have analog so i can't comment intelligently on what could be happening. but i would want to investigate that; that it works as intended when you run commando in the ./ world, but not via full pathto reference would cause irratibility in me until i discovered why.

mwhybark
04-02-2002, 01:00 PM
it's certainly puzzlin'!

I know I've heard that cron defaults to stdout so it could be that that's where the override ocurs; but i doubt it since duplicating the command provides that.

I suppose my best bet would be adding the path to do_all.sh into mycronjobs.