Solved

Why have my weekly cron jobs begun running bi-weekly?

Posted on 2008-06-25
4
476 Views
Last Modified: 2010-04-21
Here is a line from our /etc/crontab (enterprise Linux 4)

02 09 * * 1 root /admin/licenses/bin/demo.sh

For the last four weeks, the script has only run every other week.  No significant changes have been made to the server.  Running the script as root succeeds at all times.  

0
Comment
Question by:BostonDynamics
  • 2
  • 2
4 Comments
 
LVL 14

Expert Comment

by:agriesser
ID: 21866242
crontab looks sane. Can you add the following line to this command to log execution?

Have you checked your local mail (using the mail command)? crontab errors should go there usually.
I don't know what user account is configured to get the mail when crontab fails, but usually, it's either root or the defined admin user (whatever that one is called on your system).

You could check the filesizes in /var/spool/mail to see which user got mails.

To read mails from other users, issue:

su - $USERNAME -c mail    (as root)

02 09 * * 1 root echo "crontab running on $(date +"%D") >>/root/crontab.log" && /admin/licenses/bin/demo.sh

Open in new window

0
 
LVL 14

Accepted Solution

by:
agriesser earned 250 total points
ID: 21866254
Argh, scratch my code above, I made quoting errors.
Here's the correct version:

The log is available in /root/crontab.log then.
02 09 * * 1 root echo "crontab running on $(date +%D)" >>/root/crontab.log && /admin/licenses/bin/demo.sh

Open in new window

0
 

Author Comment

by:BostonDynamics
ID: 21867258
Turns out a user had an identical line in his crontab, and was locking up the script (he had files open that the root script needed).  Other weeks, root managed to run the script first and the user simply received a permission denied message.  
0
 

Author Closing Comment

by:BostonDynamics
ID: 31470577
He put us on the path to discovering the problem.
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

I am a long time windows user and for me it is normal to have spaces in directory and file names. Changing to Linux I found myself frustrated when I moved my windows data over to my new Linux computer. The problem occurs when at the command line.…
Using 'screen' for session sharing, The Simple Edition Step 1: user starts session with command: screen Step 2: other user (logged in with same user account) connects with command: screen -x Done. Both users are connected to the same CLI sessio…
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

856 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question