Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I have configured Back In Time and MySQL Administrator to make a backup every day at 15:00. In order to be sure I have installed Gnome Scheduler to see whether these two applications are registered there. They are registered in gnome scheduler but they don't perform back up operation.

Here is the screenshot of Gnome Scheduler.

alt text How can I solve this problem?

UPDATE

The output of crontab -l command is following:

bakhtiyor@ubuntu-vm:~$ crontab -l
0 15 * * * /usr/bin/mabackup -d /home/bakhtiyor/backup/MySQL -x my-backup profile # JOB_ID_3
0 15 * * * nice -n 19 /usr/bin/backintime --backup-job # JOB_ID_2

UPDATE 2

The output of grep CRON /var/log/syslog command is following:

Nov 30 11:39:01 ubuntu-vm CRON[7663]: (root) CMD (  [ -x /usr/lib/php5/maxlifetime ] && [ -d /var/lib/php5 ] && find /var/lib/php5/ -type f -cmin +$(/usr/lib/php5/maxlifetime) -print0 | xargs -n 200 -r -0 rm)
Nov 30 11:39:02 ubuntu-vm CRON[7661]: (CRON) info (No MTA installed, discarding output)
share|improve this question
    
At 15:00, you mean. ;-) –  T.J. Crowder Nov 28 '10 at 15:05
1  
You do realize these two jobs will run simultaneously? If you are trying to backup the database into ~ and then to backup your home directory this setup won't work very well. –  poolie Nov 28 '10 at 23:10
add comment

4 Answers

up vote 4 down vote accepted

Gnome Scheduler is just a pretty front-end for at and crontab. And in default Ubuntu, cron mostly runs anacron which is responsible for running periodic tasks on machines that may not be on when the task is supposed to fire.

Things to check are:

  • is cron running? ps -C cron
  • is cron configured? cat /etc/crontab
  • is cron calling anacron from /etc/crontab?
  • is anacron installed? ls /usr/sbin/anacron
  • is cron or anacron logging any messages at all? grep CRON /var/log/syslog

For the last step, logrotate may have archived older syslogs so if grep gives no result try

(cat /var/log/syslog.[0-9] ; zcat /var/log/syslog.*.gz) | grep CRON

My guess is that gnome-scheduler is setting up jobs with the wrong permissions (probably as you and not a superuser) and therefore the complaints will appear in the syslogs.

response to update

Given the shell prompt in your crontab -l example, you almost certainly listed bakhtiyor's per user crontab which may not have the permissions to run your (somewhat opaque) jobs.

The syslog entries will show if the jobs are being run at all, and if so, if the jobs complain.

share|improve this answer
    
I have checked all the options you pointed. All of them are true, i.e. cron is running, configured, etc. –  Bakhtiyor Nov 28 '10 at 15:18
1  
ok, so please add the relevant lines from syslog and crontab -l to your question so we can help further. –  msw Nov 28 '10 at 15:33
    
Please see the UPDATE part of the answer. Thank you for your intention to help. +1 –  Bakhtiyor Nov 28 '10 at 15:38
    
Please post the relevant lines from the log. Do you intend for these commands to run as you, or as root? –  poolie Nov 28 '10 at 23:08
    
@poolie. I have posted in UPDATE2 section outputs of logging –  Bakhtiyor Nov 30 '10 at 11:06
show 1 more comment

Based on your log entries, it looks like your jobs did not run recently.

You should also check the archived cron logs, because it might have turned over since they last run.

To debug this further I would add this job, using crontab -e

*/5 * * * * echo hello

and see if that sends you mail, and whether it appears in the log file.

update: If it's appearing in the log file but not sending you mail, then you might need to either install a mail agent to see the output from your backup jobs, or run them with output redirected into a log file. For instance, you could use crontab -e to change one line to

0 15 * * * nice -n 19 /usr/bin/backintime --backup-job >> ~/log/backup.log 2>&1

you will need to create the ~/log directory.

share|improve this answer
    
I have added that line as you said. What is next? –  Bakhtiyor Dec 1 '10 at 10:27
    
This command grep CRON /var/log/syslog prints me following Dec 1 11:55:01 ubuntu-vm CRON[4074]: (bakhtiyor) CMD (echo hello) Dec 1 12:00:01 ubuntu-vm CRON[4084]: (bakhtiyor) CMD (echo hello) –  Bakhtiyor Dec 1 '10 at 11:02
1  
@Bakhtiyor Update your question with the things you are trying, see here for more info: meta.askubuntu.com/questions/257/how-does-ask-ubuntu-work –  Jorge Castro Dec 2 '10 at 2:10
add comment

I had the same issue and solved it by adding my username to the crontab group.

  1. Edit /etc/group
  2. Locate the line containing crontab (there should be only 1 line)
  3. Add you username at the end (if other users are on the line, separate with a comma)
  4. reboot
share|improve this answer
add comment

I had a similar problem which gave me quite a runaround. Assuming cron, crontab and anacron are healthy, the key symptom is that the task runs correctly if invoked using gnome-schedule's "run now" button, but does not run as scheduled once left alone.

This turns out to be mostly a graphical environment issue. My recommendation is to create a wrapper for the task script, e.g. "task-wrapper":

#!/bin/sh
gnome-terminal -x /home/username/task

Make sure the task-wrapper file is executable, and create the task in gnome-schedule as an X application. Alternately, write it like this:

#!/bin/sh
export DISPLAY=:0
gnome-terminal -x /home/username/task

The /home/username/task script will now run in a console window which will close upon completion. My scripts typically require sudo authentication, so I start the "task" script like this:

#!/bin/sh
set -e
MESSAGE="The task script wants to ..."
gksudo --message "$MESSAGE" cd /whatever

The cd command is inoccuous, the MESSAGE explains what the script is requesting authorization for, and 'set -e' ensures the script aborts if the user hits 'Cancel'. The remainder of the script can use simple 'sudo' calls which will succeed unless a lot of time elapses between commands.

Under Ubuntu 12.04, crontab group membership doesn't seem to be required.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.