3 Replies Latest reply on Apr 9, 2008 10:13 AM by Mr.Flibble

    crontab - newbie help

    big vern Enthusiast

       

      I've been using the snap hunter script and had it configured in my crontab (using crontab -e) as :

       

       

      30 09 * * * /usr/bin/perl /usr/local/snap_hunter/snap_hunter.pl -c /usr/local/snap_hunter/snap_hunter.cfg

       

       

      This was working beuatifully and then it stopped on april 4th. I can run the command manually and it still works, as part of the troubleshooting I piped the reuslts into a log file, adding this on seemed to spring the job back into life , (ie it ran according to the schedule and emailed) can anyone explain why ??

       

       

      30 09 * * * /usr/bin/perl /usr/local/snap_hunter/snap_hunter.pl -c /usr/local/snap_hunter/snap_hunter.cfg > /tmp/snap.log

       

       

      As soon as i remove the > /tmp/snap.log the job stops working again.

       

       

       

       

       

      cheers

       

       

        • 1. Re: crontab - newbie help
          Mr.Flibble Hot Shot

           

          Your cron format looks good to me. I find it extremely strange that a redirect of the output would cause the scritpt to work/not work. It is possible that the perl script requires the appended log to function correctly, but I would guess this is unlikely.

           

           

          Are there signs of cron dying entirely, or just that one job? Have you checked your system for core dumps that may be generated by cron dying?

           

           

          That is all I can think of when looking at cron, but a great deal does depend on the other things you have in your crontab. You might want to run a really basic "hello world" type script via cron that appends to a log file, so you can identify if cron is indeed the problem, or the script you are using.

           

           

          • 2. Re: crontab - newbie help
            big vern Enthusiast

             

            That was the only job running in crontab,, I did test cron was running ok by doing an echo command and outputting to a file which worked.

             

             

            The snap hunter script was working ok without any kind of log output and it certainly doesn't say it needs. I can run it manually without the append and it works fine even now, its just the cronatb doesn't seem to work.

             

             

            Where would I check for the core dumps in relation to crontab.

             

             

             

             

             

            cheers

             

             

            • 3. Re: crontab - newbie help
              Mr.Flibble Hot Shot

               

              I am guessing that cron crashing and dumping core is unlikely in this case, but it was something I wanted to check as I have seen it years ago. I forget the circumstances now.

               

               

              To search for core files:

               

               

              find / -name core -print

               

               

              Is the basic method. This way crawls the entire filesystem looking for core files. A better method (IMO) is to run:

               

               

              updatedb

               

               

              (this updates the slocate database, think of it as google desktop for linux, IIRC this runs nightly on most systems nowadays)

               

               

              then:

               

               

              slocate core

               

               

               

               

               

              Again, the cause of this is much more likely something simple. I would put a "hello world" script in cron that executes 1 min before your perl script, and have it log to a file, if your hello world script executes every time, but the perl script does not, it is possible to pair down the issue. If however, the "hello world" script fails to execute, then we can identify crond as the problem.