Cron script crashing server...

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



Hiya, never thought of stracing cron itself, will try that tomorrow (is a
bit too busy to risk it going down atm).
 Thanks, Ian

 On 10/3/05, Mark Belanger <mark_belanger@xxxxxxx> wrote:
>
> Ian mu wrote:
> > Ok, weirder, thanks for the advice by the way, I guess its isolated it
> > somewhat and not where I thought it would be....added the strace, but
> > looks like not needed as never gets that far...
>
>
> The next thing I would do is to attach strace to cron just before
> it kicks off. Make sure to capture the output - there will be a lot
> of it. strace -p PIDofCron -f -o/path/somefile
>
> You might also look at the cron file with an octal editor to make
> sure there are no funny characters in it. Or just create a brand
> new one.
>
> I would also look carefully each directory in the path and
> the contents of them as well i.e.
>
> ls -ld /home
> ls -la /home
> ls -ld /home/statsman
> ls -la /home/statsman
> ls -ld /home/statsman/stats
> ls -la /home/statsman/stats
>
> -Mark
>
> >
> > Piped the cron commandline to a file crondebug as mark suggested, its
> > created at cron run time, but empty.
> > 36 13 * * *
> > >/home/statsman/stats/crondebug
> >
> > For the first line of the run_stats.sh (tried also with #!/bin/bash)
> > file it calls I added
> >
> > echo "stage 1" >> /home/statsman/stats/gendebug
> >
> > Run it manually from console it echos stage 1, (also echo stage 2 I
> > added, then after that the perl script is invoked) fine.
> >
> > Run from cron it never even does the echo "stage 1" to the file (or at
> > least doesn't create it).
> >
> > So it looks like its either dying on execing the file and not getting
> > any further as it never writes the first line of the simple bash script
> > or not even trying to call the file? (file gendebug isn't even created).
> >
> > More puzzled at this moment than I thought (nothing in root mail from
> > cron either btw, and rest of crontab seems ok, I leave the line in just
> > comment out the line with a single # and it doesn't crash ).
> >
> > Baffled :), thanks again, Ian
> >
> >
> >
> >
> > On 10/3/05, *Ingimar Robertsson* <iar@xxxxxxxx <mailto:iar@xxxxxxxx>>
> > wrote:
> >
> > You could also check what environment variables the perl and shell
> > scripts
> > depend upon. Perhaps they are missing in the cron environment (Cron
> > jobs
> > don't get the whole shell environment, which might explain why it
> > does work
> > from the shell)
> >
> >
> > On Mon, Oct 03, 2005 at 07:39:48AM -0400, Mark Belanger wrote:
> > > Ian mu wrote:
> > > > Basically I have a perl script that runs once, first thing every
> > > > morning, gathering some stats (currently turned off due to
> > problem).
> > > > Crontab -l shows the following...
> > > >
> > > > 00 6 * * * nice /home/statsman/stats/run_stats.sh >/dev/null
> > 2>&1 (.sh
> > > > file basically sources with full path a config with some vars,
> > then runs
> > > > the perl script).
> > >
> > > The first thing I would do to put some echos in run_stats.sh
> > > and change > /dev/null to > /path/somefile
> > >
> > > If you're getting as far as the perl script, put some print
> > > statements in it.
> > >
> > > You might try doing an strace from cron:
> > >
> > > 00 6 * * * strace -f -oOutputFile /home/statsman/stats/run_stats.sh
> > > >/path/somefile 2>&1
> > >
> > > -Mark
> > >
> > > _______________________________________________
> > > CentOS mailing list
> > > CentOS@xxxxxxxxxx <mailto:CentOS@xxxxxxxxxx>
> > > http://lists.centos.org/mailman/listinfo/centos
> >
> >
> > Bestu kve?jur,
> >
> > Ingimar
> >
> > --
> > Ingimar R?bertsson, kerfisstj?ri, RHCE EMAIL: iar@xxxxxxxx
> > <mailto:iar@xxxxxxxx>
> > Sk?rr hf TEL: +354-5695100
> > ?rm?li 2, 108 Reykjav?k FAX: +354-5695251
> > http://www.skyrr.is/legal/disclaimer.txt
> > _______________________________________________
> > CentOS mailing list
> > CentOS@xxxxxxxxxx <mailto:CentOS@xxxxxxxxxx>
> > http://lists.centos.org/mailman/listinfo/centos
> >
> >
> >
> > ------------------------------------------------------------------------
> >
> > _______________________________________________
> > CentOS mailing list
> > CentOS@xxxxxxxxxx
> > http://lists.centos.org/mailman/listinfo/centos
>
>
> --
> Mark Belanger
> LTX Corporation
> _______________________________________________
> CentOS mailing list
> CentOS@xxxxxxxxxx
> http://lists.centos.org/mailman/listinfo/centos
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.centos.org/pipermail/centos/attachments/20051003/cd89e6f7/attachment.htm

[Index of Archives]     [CentOS]     [CentOS Announce]     [CentOS Development]     [CentOS ARM Devel]     [CentOS Docs]     [CentOS Virtualization]     [Carrier Grade Linux]     [Linux Media]     [Asterisk]     [DCCP]     [Netdev]     [Xorg]     [Linux USB]
  Powered by Linux