Announcement

Collapse
No announcement yet.

SOLVED: Cron job won't run

Collapse
This topic is closed.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    SOLVED: Cron job won't run

    I've found several threads with a title similar to this one, but none that I could find with exactly the same problem.

    I have installed Simple Linux Backup from this site: http://simplelinuxbkup.sourceforge.net

    I followed the instructions on this site http://www.desktoplinux.com/articles/AT2280165098.html to set up a backup strategy. I have the cron job scheduled to run daily at 2:00 AM, but it will not run when scheduled. However, if I go into KCron, right-click on the Task, and select Run Now, it works.

    The Backup is set to run as root, and I ran KCron as root to set up the schedule.

    I'm not sure what other information is necessary to troubleshoot this. If additional info is needed, please let me know, and I'll get it for you if I know how.

    If anyone has any ideas, I would appreciate the help.
    I am relatively new to Linux, but quite experienced with DOS and Windows.&nbsp; I&#39;m comfortable editing things like fstab, etc., but I need specific instructions of what files to edit and what to add.<br /><br />My system is Kubuntu 10.10, using KDE 4.5.1.

    #2
    Re: Cron job won't run

    Not familiar with that piece of software, but here's a short checklist of things to try:

    1. Does the software create a log you could check?
    2. Check cron's log /var/log/cron.log to see if there are any messages related to that cronjob
    3. How did you add the cronjob? Try adding the job directly to /etc/crontab (alternatively you can create a new cron schedule file in /etc/cron.d/)
    ('man 5 crontab' gives information on the syntax for crontab entries if you need it)

    Comment


      #3
      Re: Cron job won't run

      Originally posted by kubicle
      Not familiar with that piece of software, but here's a short checklist of things to try:

      1. Does the software create a log you could check?
      2. Check cron's log /var/log/cron.log to see if there are any messages related to that cronjob
      3. How did you add the cronjob? Try adding the job directly to /etc/crontab (alternatively you can create a new cron schedule file in /etc/cron.d/)
      ('man 5 crontab' gives information on the syntax for crontab entries if you need it)
      Thanks. I'll give these a go tonight.
      I am relatively new to Linux, but quite experienced with DOS and Windows.&nbsp; I&#39;m comfortable editing things like fstab, etc., but I need specific instructions of what files to edit and what to add.<br /><br />My system is Kubuntu 10.10, using KDE 4.5.1.

      Comment


        #4
        Re: Cron job won't run

        Originally posted by kubicle
        Not familiar with that piece of software, but here's a short checklist of things to try:

        1. Does the software create a log you could check?
        2. Check cron's log /var/log/cron.log to see if there are any messages related to that cronjob
        3. How did you add the cronjob? Try adding the job directly to /etc/crontab (alternatively you can create a new cron schedule file in /etc/cron.d/)
        ('man 5 crontab' gives information on the syntax for crontab entries if you need it)
        1. It creates a log if it runs, but apparently it never gets launched by cron, so no log.
        2. I've searched my entire drive for cron.log, none found.
        3. I created it using kcron, according to the instructions found here: http://www.desktoplinux.com/articles/AT2280165098.html (written by the author of Simple Backup program).

        I have verified that the cron service is running, via System Services module in System Settings.

        I'm fairly sure it is set up correctly in cron, because if I go into KCron, right-click the task, and select Run Now, it runs perfectly. It just won't kick off at the scheduled time. The line from /etc/crontab is:

        # Everyday System Backup
        0 2 * * * /home/ken/SimpleBackup/bkup /home/ken/SimpleBackup/bkup
        I am relatively new to Linux, but quite experienced with DOS and Windows.&nbsp; I&#39;m comfortable editing things like fstab, etc., but I need specific instructions of what files to edit and what to add.<br /><br />My system is Kubuntu 10.10, using KDE 4.5.1.

        Comment


          #5
          Re: Cron job won't run

          Originally posted by beckfield
          2. I've searched my entire drive for cron.log, none found.
          Now that I think about it, it's entirely possible cron logging is disabled by default, that means cron log entries are commented out in the log config file, which I think is /etc/syslog.conf (I use syslog-ng instead of the default syslog, so I can't tell for sure).
          I'm fairly sure it is set up correctly in cron, because if I go into KCron, right-click the task, and select Run Now, it runs perfectly. It just won't kick off at the scheduled time. The line from /etc/crontab is:

          # Everyday System Backup
          0 2 * * * /home/ken/SimpleBackup/bkup /home/ken/SimpleBackup/bkup
          That line does not seem to be a valid /etc/crontab line, the syntax is:
          m h dom mon dow user command
          try editing /etc/crontab ('kdesudo kate /etc/crontab') and put in:
          0 2 * * * root /home/ken/SimpleBackup/bkup
          (provided you want to run it as root, and the command is /home/ken/SimpleBackup/bkup)

          Comment


            #6
            Re: Cron job won't run

            Originally posted by kubicle

            That line does not seem to be a valid /etc/crontab line, the syntax is:
            m h dom mon dow user command
            try editing /etc/crontab ('kdesudo kate /etc/crontab') and put in:
            0 2 * * * root /home/ken/SimpleBackup/bkup
            (provided you want to run it as root, and the command is /home/ken/SimpleBackup/bkup)
            I deleted everything from crontab that kcron created, and let kcron modify the file again. It seems incapable of adding the "root" user, so I added it manually.

            I'll know tomorrow if it worked. Yes, I do want it to run as root, so it can access some of the system files.

            Thanks for your help.
            I am relatively new to Linux, but quite experienced with DOS and Windows.&nbsp; I&#39;m comfortable editing things like fstab, etc., but I need specific instructions of what files to edit and what to add.<br /><br />My system is Kubuntu 10.10, using KDE 4.5.1.

            Comment


              #7
              Re: Cron job won't run

              Okay, it worked.

              KCron is not adding the user name to the crontab file. When I added it, so the line looks just like kubicle's example, the job ran on schedule.

              Thanks for your help!
              I am relatively new to Linux, but quite experienced with DOS and Windows.&nbsp; I&#39;m comfortable editing things like fstab, etc., but I need specific instructions of what files to edit and what to add.<br /><br />My system is Kubuntu 10.10, using KDE 4.5.1.

              Comment

              Working...
              X