I've just now got 'round to figuring out why I've been getting alot of
chown/chgrp errors out of my cron job that runs exicyclog, and I thought
I'd share it in case anyone else has the same (totally non-serious) problem...
This is exim 1.92 and DEC OSF/1 V3.0 (Yep, I know it's ancient)
In exicyclog is the following bit of code
a=`ls -lg $mainlog`
b=`ls -l $mainlog`
user=`echo "$a\n$b\n" | awk 'BEGIN { OFS=""} { if ($5 ~ /^[0-9]+$/) print
$3; }'`
group=`echo "$a\n$b\n" | awk 'BEGIN { OFS=""} { if ($5 ~ /^[0-9]+$/) print
$4; )'`
On my system, that results in
user=root\nroot
group=bin\nbin
Which of course causes future chown $user and chgrp $group commands no end
of confusion :-)
My simple solution is to remove \n$b\n from both echo's, but that's not a
"general" solution as that assumes that ls -lg does what Phillip wants,
which, if it did on all systems would eliminate the need for that bit of code.
Whilst I was poking around in there, I also noticed that the handy
definitions of chown, chgrp, mv and rm aren't used everywhere they could
be. That leads me to 2 questions...
- Should they be used "everywhere" in exicyclog?
- Why are they there at all? What systems don't support chown, chgrp, mv
and rm as commands that root can execute as part of a cron job (so I can
make sure I never get one of those systems)?
Bruce
Bruce Bowler, Research Associate 207.633.9600 (voice)
Bigelow Laboratory for Ocean Sciences 207.633.9641 (fax)
PO Box 475 BBowler@??? (email)
West Boothbay Harbor ME 04575 http://www.bigelow.org/
--
*** Exim information can be found at
http://www.exim.org/ ***