Find the answer to your Linux question:
Results 1 to 5 of 5
Running SuSE 10, checked services under yast to see if cron is started and it says it is. Also did ps aux | grep cron , which came back with: ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined! watchman's Avatar
    Join Date
    Apr 2006
    Location
    Maine, USA
    Posts
    10

    CRON not running


    Running SuSE 10, checked services under yast to see if cron is started and it says it is. Also did ps aux | grep cron, which came back with:

    root 15985 0.0 0.0 1780 632 ? Ss 02:35 0:00 /usr/sbin/cron
    root 16105 0.0 0.0 1824 604 pts/0 R+ 02:54 0:00 grep cron

    So, it should be running.

    Did crontab -e, made my my changes, and then did crontab -l which gave me:

    SHELL=/bin/bash
    PATH=/sbin:/bin:/usr/bin:/usr/sbin:/scripts
    MAILTO=root
    HOME=/


    0 */2 * * * root sh /etc/samba/netlogon/weather.sh
    0 2 * * * root sh /scripts/backup-daily.sh
    0 3 * * Sat root sh /scripts/backup-weekly.sh
    0 5 1 * * root sh /scripts/backup-monthly.sh
    0 7,19 * * * root /usr/bin/updatedb

    So, I think everything looks ok, I want the first task to run every two hours, the second to run daily at 0200, the third every saturday at 0300, the fourth at 0500 on the first of each month, and the last to run daily at 0700 and 1900.

    All of these scripts work fine when I run them manually, so I know it's not a chmod issue, it's just that NONE of them run when they are supposed to under cron. (I have restarted the machine and restarted the service).

    New to all this, so don't know if it is my crontab file, etc. Any suggestions would be helpful. Thanks.

  2. #2
    Just Joined! scottro's Avatar
    Join Date
    Feb 2006
    Posts
    57
    With cron, nine times out of ten, it has to do with the $PATH variable. Cron only sees a few things. So, if one of the commands in your script has a path say, to /usr/local/bin (more common in FreeBSD) cron won't be able to find the command. In your script, try putting the complete path to all commands in the script. For instance, in backup.sh, suppose you had the command rsync and it's in /usr/local/bin/. You'd have to put /usr/local/bin/rsync.

    I don't know if this is the problem in your case, but it seems the most likely scenario, as cron can be picky.

    However, one thing that makes me doubt my own guess is that cron usually sends root an email saying that a command failed because it can't locate the command.

  3. #3
    Just Joined! watchman's Avatar
    Join Date
    Apr 2006
    Location
    Maine, USA
    Posts
    10
    root is not getting any email on failed cron jobs, but add /usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin to the path.

    Will see if this works.

  4. #4
    Just Joined! watchman's Avatar
    Join Date
    Apr 2006
    Location
    Maine, USA
    Posts
    10
    That didn't fix it, but was worth a try. Any other suggestions would be greatly appreciated.

  5. #5
    Just Joined! watchman's Avatar
    Join Date
    Apr 2006
    Location
    Maine, USA
    Posts
    10
    Working now- after several days of frustration I left the problem alone. Figured I go shooting this last weekend and tackle it later with a little time off and maybe a fresh mind. Alas, when I returned, I checked my emails and there were my backup logs. It appears that cron started working over the weekend (Sunday morning to be exact) when nobody was here. I checked the uptimes and the machine was not rebooted or shutdown, nobody was here, and I am the only admin. It just started working! I am happy that it is working, but I HATE not knowing what happened. Oh well, must have been those dang gremlins...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •