<div>Hiya, redid the crontab file and still crashed, had the strace running on it and compared the run without cron to the run from cron. It does actually run the stats script so was misleading before, so I'm guessing previously just hadn't got as far as outputting it to file or something. 
</div>
<div> </div>
<div>There's loads of stuff in there, so just highlighting the end where there seems to be a difference in case anything springs to mind...</div>
<div> </div>
<div>I don't want anyone to go through the pain of spending time to debug everything naturally (not my script and thousands of lines in it anyway), it was really just in case something popped out at them obvious.</div>
<div> </div>
<div>Thanks for the replies, Ian.</div>
<div> </div>
<div> </div>
<div>Working none cron strace for script up to the point the cron equivalent dies.</div>
<div> </div>
<div>3045  read(4, ",\n            \'*\' => \'ae181a\',\n "..., 4096) = 4096<br>3045  brk(0)                            = 0x9fe9000<br>3045  brk(0xa00a000)                    = 0xa00a000<br>3045  read(4, ">[0] eq \'COMT\' and $r >= $floor;"..., 4096) = 4096
<br>3045  read(4, "\n}\n\n### MODS ###################"..., 4096) = 3988<br>3045  brk(0)                            = 0xa00a000<br>3045  brk(0xa02b000)                    = 0xa02b000<br>3045  read(4, "", 4096)                 = 0
<br>3045  close(4)                          = 0<br>3045  open("", O_RDONLY|O_LARGEFILE)    = -1 ENOENT (No such file or directory)</div>
<div>>>Via cron never reaches here</div>
<div>3045  read(3, "T:ALL]\";\n$snipe_head{ \'GARAND_SC"..., 4096) = 4096<br> </div>
<div> </div>
<div>Crashing server from cron strace, 10297 is the script, 10296 is a mrtg running from a different account which runs fine whatever...</div>
<div> </div>
<div>10297 read(4, ",\n            \'*\' => \'ae181a\',\n "..., 4096) = 4096<br>10296 read(4, " \'0\' x 6\n# creates deep recursio"..., 4096) = 4096<br>10297 read(4, ">[0] eq \'COMT\' and $r >= $floor;"..., 4096) = 4096
<br>10297 brk(0)                            = 0x870a000<br>10297 brk(0x872b000)                    = 0x872b000<br>10296 read(4, "|| $x->is_zero();\n\n  my $sign = "..., 4096) = 4096<br>10296 stat64("/usr/bin/../lib/mrtg2/integer.pmc", 0xbfff9ba0) = -1 ENOENT (No such file or directory)
<br>10296 open("/usr/bin/../lib/mrtg2/integer.pm", O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such file or directory)<br>10296 stat64("/usr/bin/integer.pmc", 0xbfff9ba0) = -1 ENOENT (No such file or directory)
<br>10296 open("/usr/bin/integer.pm", O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such file or directory)<br>10296 stat64("/usr/lib/perl5/5.8.0/i386-linux-thread-multi/integer.pmc", 0xbfff9ba0) = -1 ENOENT (No such file or directory)
<br>10296 open("/usr/lib/perl5/5.8.0/i386-linux-thread-multi/integer.pm", O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such file or directory)<br>10296 stat64("/usr/lib/perl5/5.8.0/integer.pmc", 0xbfff9ba0) = -1 ENOENT (No such file or directory)
<br>10296 open("/usr/lib/perl5/5.8.0/integer.pm", O_RDONLY|O_LARGEFILE) = 5<br>10296 ioctl(5, SNDCTL_TMR_TIMEBASE or TCGETS, 0xbfff99a8) = -1 ENOTTY (Inappropriate ioctl for device)<br>10296 _llseek(5, 0, [0], SEEK_CUR)      = 0
<br>10297 read(4,  <unfinished ...><br>10296 read(5,  <unfinished ...><br>10297 <... read resumed> "\n}\n\n### MODS ###################"..., 4096) = 3988<br>10296 <... read resumed> "package integer;\n\nour $VERSION ="..., 4096) = 3266
<br>10296 read(5, "", 4096)                 = 0<br>10296 close(5)                          = 0<br>10296 brk(0)                            = 0x9229000<br>10296 brk(0x924a000)                    = 0x924a000<br>10297 read(4, "", 4096)                 = 0
<br>10297 close(4)                          = 0<br>10296 read(4, "the nth decimal digit, negative "..., 4096) = 4096<br>10297 open("", O_RDONLY|O_LARGEFILE <unfinished ...><br>10296 read(4, "norm(), but $x\n\n  my $x = shift;"..., 4096) = 4096
<br><strace stopped here></div>
<div> </div>
<div><br><br> </div>
<div><span class="gmail_quote">On 10/3/05, <b class="gmail_sendername">Ian mu</b> <<a href="mailto:mu.llamas@gmail.com">mu.llamas@gmail.com</a>> wrote:</span>
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">
<div>Hiya, never thought of stracing cron itself, will try that tomorrow (is a bit too busy to risk it going down atm).</div>
<div> </div>
<div>Thanks, Ian<br><br> </div>
<div><span class="e" id="q_106b69d8c967de87_1">
<div><span class="gmail_quote">On 10/3/05, <b class="gmail_sendername">Mark Belanger</b> <<a onclick="return top.js.OpenExtLink(window,event,this)" href="mailto:mark_belanger@ltx.com" target="_blank">mark_belanger@ltx.com
</a>> wrote:</span> 
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">Ian mu wrote:<br>> Ok, weirder, thanks for the advice by the way, I guess its isolated it<br>> somewhat and not where I thought it would be....added the strace, but 
<br>> looks like not needed as never gets that far...<br><br><br>The next thing I would do is to attach strace to cron just before<br>it kicks off.  Make sure to capture the output - there will be a lot<br>of it. strace -p PIDofCron -f -o/path/somefile 
<br><br>You might also look at the cron file with an octal editor to make<br>sure there are no funny characters in it.  Or just create a brand<br>new one.<br><br>I would also look carefully each directory in the path and<br>
the contents of them as well i.e.<br><br>ls -ld /home<br>ls -la /home<br>ls -ld /home/statsman<br>ls -la /home/statsman<br>ls -ld /home/statsman/stats<br>ls -la /home/statsman/stats<br><br>-Mark<br><br>><br>> Piped the cron commandline to a file crondebug as mark suggested, its 
<br>> created at cron run time, but empty.<br>> 36 13 * * *<br>>  >/home/statsman/stats/crondebug<br>><br>> For the first line of the run_stats.sh (tried also with #!/bin/bash)<br>> file it calls I added 
<br>><br>> echo "stage 1" >> /home/statsman/stats/gendebug<br>><br>> Run it manually from console it echos stage 1, (also echo stage 2 I<br>> added, then after that the perl script is invoked) fine. 
<br>><br>> Run from cron it never even does the echo "stage 1" to the file (or at<br>> least doesn't create it).<br>><br>> So it looks like its either dying on execing the file and not getting<br>
> any further as it never writes the first line of the simple bash script<br>> or not even trying to call the file? (file gendebug isn't even created).<br>><br>> More puzzled at this moment than I thought (nothing in root mail from 
<br>> cron either btw, and rest of crontab seems ok, I leave the line in just<br>> comment out the line with a single # and it doesn't crash ).<br>><br>> Baffled :), thanks again, Ian<br>><br>><br>><br>
><br>> On 10/3/05, *Ingimar Robertsson* <<a onclick="return top.js.OpenExtLink(window,event,this)" href="mailto:iar@skyrr.is" target="_blank">iar@skyrr.is</a> <mailto:<a onclick="return top.js.OpenExtLink(window,event,this)" href="mailto:iar@skyrr.is" target="_blank">
iar@skyrr.is</a>>><br>> wrote:<br>><br>>     You could also check what environment variables the perl and shell <br>>     scripts<br>>     depend upon.  Perhaps they are missing in the cron environment (Cron
<br>>     jobs<br>>     don't get the whole shell environment, which might explain why it<br>>     does work<br>>     from the shell)<br>><br>><br>>     On Mon, Oct 03, 2005 at 07:39:48AM -0400, Mark Belanger wrote:
<br>>      > Ian mu wrote:<br>>      > > Basically I have a perl script that runs once, first thing every <br>>      > > morning, gathering some stats (currently turned off due to<br>>     problem).
<br>>      > > Crontab -l shows the following...<br>>      > ><br>>      > > 00 6  * * * nice /home/statsman/stats/run_stats.sh  >/dev/null <br>>     2>&1 (.sh<br>>      > > file basically sources with full path a config with some vars,
<br>>     then runs<br>>      > > the perl script).<br>>      ><br>>      > The first thing I would do to put some echos in run_stats.sh <br>>      > and change > /dev/null to > /path/somefile
<br>>      ><br>>      > If you're getting as far as the perl script, put some print<br>>      > statements in it.<br>>      ><br>>      > You might try doing an strace from cron:<br>>      >
<br>>      > 00 6  * * * strace -f -oOutputFile /home/statsman/stats/run_stats.sh<br>>      > >/path/somefile 2>&1<br>>      > <br>>      > -Mark<br>>      ><br>>      > _______________________________________________
<br>>      > CentOS mailing list<br>>      > <a onclick="return top.js.OpenExtLink(window,event,this)" href="mailto:CentOS@centos.org" target="_blank">CentOS@centos.org</a> <mailto:<a onclick="return top.js.OpenExtLink(window,event,this)" href="mailto:CentOS@centos.org" target="_blank">
CentOS@centos.org</a>><br>>      > <a onclick="return top.js.OpenExtLink(window,event,this)" href="http://lists.centos.org/mailman/listinfo/centos" target="_blank">http://lists.centos.org/mailman/listinfo/centos</a>
<br>><br>><br>>     Bestu kveðjur, <br>><br>>     Ingimar<br>><br>>     --<br>>     Ingimar Róbertsson, kerfisstjóri, RHCE          EMAIL: <a onclick="return top.js.OpenExtLink(window,event,this)" href="mailto:iar@skyrr.is" target="_blank">
iar@skyrr.is</a><br>>     <mailto:<a onclick="return top.js.OpenExtLink(window,event,this)" href="mailto:iar@skyrr.is" target="_blank">iar@skyrr.is </a>><br>>     Skýrr hf                                        TEL:   +354-5695100
<br>>     Ármúli 2, 108 Reykjavík                         FAX:   +354-5695251<br>>                <a onclick="return top.js.OpenExtLink(window,event,this)" href="http://www.skyrr.is/legal/disclaimer.txt" target="_blank">
 http://www.skyrr.is/legal/disclaimer.txt</a><br>>     _______________________________________________<br>>     CentOS mailing list<br>>     <a onclick="return top.js.OpenExtLink(window,event,this)" href="mailto:CentOS@centos.org" target="_blank">
CentOS@centos.org</a> <mailto:<a onclick="return top.js.OpenExtLink(window,event,this)" href="mailto:CentOS@centos.org" target="_blank"> CentOS@centos.org</a>><br>>     <a onclick="return top.js.OpenExtLink(window,event,this)" href="http://lists.centos.org/mailman/listinfo/centos" target="_blank">
http://lists.centos.org/mailman/listinfo/centos</a><br>><br>><br>><br>> ------------------------------------------------------------------------ <br>><br>> _______________________________________________
<br>> CentOS mailing list<br>> <a onclick="return top.js.OpenExtLink(window,event,this)" href="mailto:CentOS@centos.org" target="_blank">CentOS@centos.org</a><br>> <a onclick="return top.js.OpenExtLink(window,event,this)" href="http://lists.centos.org/mailman/listinfo/centos" target="_blank">
http://lists.centos.org/mailman/listinfo/centos</a><br><br><br>--<br>Mark Belanger<br>LTX Corporation<br>_______________________________________________<br>CentOS mailing list<br><a onclick="return top.js.OpenExtLink(window,event,this)" href="mailto:CentOS@centos.org" target="_blank">
CentOS@centos.org </a><br><a onclick="return top.js.OpenExtLink(window,event,this)" href="http://lists.centos.org/mailman/listinfo/centos" target="_blank">http://lists.centos.org/mailman/listinfo/centos</a><br></blockquote>
</div><br></span></div></blockquote></div><br>