[sf-perl] Log stomping

David Alban extasia at extasia.org
Wed Aug 24 09:47:55 PDT 2005


On 8/23/05, Garth Webb <garth at perijove.com> wrote:
> I ran your first 'foo' script with the first crontab and I got all 16 (2
> x 8) lines, without any stomping.  I thought maybe if I set auto
> flushing ($| = 1) I'd get some intermixed lines between the process, but
> still the same basic output.

Interesting.  My log stomping is occuring on a solaris 8 machine, on
which /bin/sh (which is not a symlink) is the default shell for cron. 
On a hunch, I ran:

35 9 * * * bash -c "$HOME/foo one   >> $HOME/log 2>&1"
35 9 * * * bash -c "$HOME/foo two   >> $HOME/log 2>&1"
35 9 * * * bash -c "$HOME/foo three >> $HOME/log 2>&1"
35 9 * * * bash -c "$HOME/foo four  >> $HOME/log 2>&1"
35 9 * * * bash -c "$HOME/foo five  >> $HOME/log 2>&1"
35 9 * * * bash -c "$HOME/foo six   >> $HOME/log 2>&1"
35 9 * * * bash -c "$HOME/foo seven >> $HOME/log 2>&1"
35 9 * * * bash -c "$HOME/foo eight >> $HOME/log 2>&1"

No log stomping!  All expected lines appended unmolested to log file!

Huh.  Lemme try "ksh -c ..."

No log stomping!  All expected lines appended unmolested to log file!

O.K., now let me try sh again, but with a command string, as I've
tried above with bash and ksh.

Hmmm.  Log stomping again.  So it looks like solaris 8's /bin/sh is
the environment in which the stomping is occuring.  Easy enough to
avoid...

Thanks!

-- 
Live in a world of your own, but always welcome visitors.


More information about the SanFrancisco-pm mailing list