3

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)
Germar
  • 6,217
  • 2
  • 24
  • 39
Bakhtiyor
  • 12,124
  • 25
  • 65
  • 81

5 Answers5

5

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.

msw
  • 4,668
  • 1
  • 24
  • 26
  • 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
  • @msw. You were right. I think the only problem I had is that gnome-scheduler was running under the wrong permission. I run it using my user name instead of running as root. Thnx – Bakhtiyor Dec 02 '10 at 16:47
2

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.

poolie
  • 9,161
  • 4
  • 38
  • 62
  • I have added that line as you said. What is next? – Bakhtiyor Dec 01 '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 01 '10 at 11:02
  • 1
    @Bakhtiyor Update your question with the things you are trying, see here for more info: http://meta.askubuntu.com/questions/257/how-does-ask-ubuntu-work – Jorge Castro Dec 02 '10 at 02:10
  • Mail agent is simple: `sudo apt-get install ssmtp` then configure it as per https://unix.stackexchange.com/questions/363814/simplest-way-to-send-one-line-mail-out-via-command-line-using-gmail/363815#363815 - it works great with gmail using this set of instructions. – SDsolar Oct 09 '17 at 18:23
1

This solution worked for me: https://answers.launchpad.net/backintime/+question/90513

My job configuration was saved under my user and not root because I was using sudo backintime-gnome and not gksu backintime-gnome.

sudo will not change HOME environ which causes problems:

$ sudo env | grep ^HOME
HOME=/home/user
$ gksu env | grep ^HOME
HOME=/root
muru
  • 193,181
  • 53
  • 473
  • 722
Bjopp
  • 11
  • 1
0

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
BuZZ-dEE
  • 13,993
  • 18
  • 63
  • 80
0

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.

Urhixidur
  • 223
  • 3
  • 11