LinuxQuestions.org
Go Job Hunting at the LQ Job Marketplace
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices

Reply
 
Search this Thread
Old 01-05-2011, 08:55 AM   #1
bluethundr
Member
 
Registered: Jun 2003
Location: Summit, NJ
Distribution: CentOS 5.4
Posts: 122

Rep: Reputation: 15
Post cron backup job fails to run


hey LQ!

long time no hear! I'm having a small issue where the backup jobs
that I set to run in the crontab of the backup user do not appear to
be running. Here's how I set it up (with crontab -e as the backup
user):

run amanda every night (check at 2:45 and backup at 3)
Code:
45 2 * * * /usr/sbin/amcheck 1>>  /var/log/amanda/crontab/amcheck.log
* 3 * * * /usr/sbin/amdump  1>> /var/log/amanda/crontab/amdump.log
The executables are where they are supposed to be and run if you type
them in on the command line:

Code:
[amandabackup@amanda ~]$ ls -l /usr/sbin/amcheck
-rwsr-x--- 1 root disk 68624 Dec 29 14:08 /usr/sbin/amcheck
and

Code:
[amandabackup@amanda ~]$ ls -l /usr/sbin/amdump
-rwxr-xr-x 1 amandabackup disk 9637 Dec 29 14:08 /usr/sbin/amdump
both do actually work!

Although I'm not sure what the 's' indicates in the permissions of amcheck.


And here's a tail of the cron logs

Code:
[root@amanda init.d]# tail /var/log/cron
Jan  5 07:01:01 newamanda crond[13612]: (root) CMD (run-parts /etc/cron.hourly)
Jan  5 07:17:09 newamanda crontab[13652]: (amandabackup) BEGIN EDIT
(amandabackup)
Jan  5 07:18:00 newamanda crontab[13652]: (amandabackup) REPLACE (amandabackup)
Jan  5 07:18:00 newamanda crontab[13652]: (amandabackup) END EDIT (amandabackup)
Jan  5 07:18:01 newamanda crond[1448]: (amandabackup) RELOAD (cron/amandabackup)
Jan  5 07:18:39 newamanda crond[13686]: (CRON) STARTUP (V5.0)
Jan  5 07:23:01 newamanda crontab[13699]: (amandabackup) BEGIN EDIT
(amandabackup)
Jan  5 07:23:47 newamanda crontab[13699]: (amandabackup) END EDIT (amandabackup)
Jan  5 07:25:38 newamanda crontab[13751]: (amandabackup) BEGIN EDIT
(amandabackup)
Jan  5 07:25:53 newamanda crontab[13751]: (amandabackup) END EDIT (amandabackup)
And the cron daemon is running:

Code:
bluethundr@amanda:~/rpm$ sudo ps -ef | grep cron
root     13686     1  0 07:18 ?        00:00:00 crond
1001     14318 14274  0 09:51 pts/3    00:00:00 grep --color=auto cron
I would certainly appreciate any thoughts on this situation that you might be willing to share!

 
Old 01-05-2011, 09:21 AM   #2
Reuti
Senior Member
 
Registered: Dec 2004
Location: Marburg, Germany
Distribution: openSUSE 13.1
Posts: 1,320

Rep: Reputation: 252Reputation: 252Reputation: 252
Some remarks:

Code:
* 3 * * *
will mean each minute from 03:00 to 03:59. If it should happen only one time, the minute must be specified.

Code:
[amandabackup@amanda ~]$ ls -l /usr/sbin/amcheck
-rwsr-x--- 1 root disk 68624 Dec 29 14:08 /usr/sbin/amcheck
The 's' means "set uid" and it will run as the root user, even when it's started by an ordinary user. To check that cron on its own is working fine, can you define a script:

Code:
#!/bin/sh
date >> $HOME/logfile
(make it executable) and check the output? To test this the above rule with an asterisk for the minute is perfect.
 
Old 01-05-2011, 12:42 PM   #3
ptader
LQ Newbie
 
Registered: Jan 2011
Location: Chicago, Il. USA
Distribution: Ubuntu
Posts: 4

Rep: Reputation: 0
Some more considerations:

Your command...

[root@amanda init.d]# tail /var/log/cron

...doesn't show us the relevant time from the cron log file. In other words, your tail starts with the time 07:01:01 A.M., but the time we need to see is around 2:45 - 4am. If that time frame isn't in the current cron log file, it might have been rotated out. Look for files like cron.1, cron.2 and look (more, less, cat, etc.) through those files.

Second, did the cron job create a /var/log/amanda/crontab/amcheck.log or /var/log/amanda/crontab/amdump.log file? What's in them?

Hoping that helps...
 
Old 01-05-2011, 08:33 PM   #4
choogendyk
Senior Member
 
Registered: Aug 2007
Location: Massachusetts, USA
Distribution: Solaris 9 & 10, Mac OS X, Ubuntu Server
Posts: 1,189

Rep: Reputation: 105Reputation: 105
Just a couple of comments.

Presuming you work in the daytime, there is not much point in running amcheck at 2:45am and then running amdump at 3:00am (assuming you meant to do "0 3 * * *"), since there is no one around to respond to the amcheck. Typically, you would run amcheck around 15:00 in the afternoon so that you can do something about any issues there might be and not have an amdump fail in the middle of the night.

Second, is your configuration actually named "1"? amcheck and amdump take at least the name of the configuration as an argument. Typically, that would be something like "daily", and your command would be `amcheck daily`.

Third, you are routing the output to /var/log/amanda/crontab/amcheck.log and amdump.log. Is there anything in those files after your run? I'm inclined to think not, because amcheck and amdump, when run from cron, typically spawn off as daemon like processes and send you a report by email. Your email should be in the amanda.conf in the configuration directory.

Can you tell us anything about your installation and configuration of Amanda?
 
Old 01-06-2011, 03:35 AM   #5
Reuti
Senior Member
 
Registered: Dec 2004
Location: Marburg, Germany
Distribution: openSUSE 13.1
Posts: 1,320

Rep: Reputation: 252Reputation: 252Reputation: 252
Quote:
Originally Posted by choogendyk View Post
Second, is your configuration actually named "1"?
AFAICS the 1>> is the same like >> and referring to stdout. So this should be fine.
 
Old 01-06-2011, 05:50 AM   #6
choogendyk
Senior Member
 
Registered: Aug 2007
Location: Massachusetts, USA
Distribution: Solaris 9 & 10, Mac OS X, Ubuntu Server
Posts: 1,189

Rep: Reputation: 105Reputation: 105
Quote:
Originally Posted by Reuti View Post
AFAICS the 1>> is the same like >> and referring to stdout. So this should be fine.
Of course. I was looking for the required argument and missed the lack of a space there. Typically, one wouldn't need or put the 1 there, since it is assumed.

Anyway, that clarifies that the commands are missing the required argument, which is the name of the configuration that they are to run. Since they are designed to run in background from cron and send reports via email, I would just get rid of all the extraneous >> stuff.
 
  


Reply

Tags
centos55, crond


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Cron job fails kushanx Linux - Server 9 04-09-2010 01:05 AM
Cron job to backup prudens Linux - Newbie 16 08-10-2009 07:04 AM
Backup script won't run in cron job. Why? Micro420 Linux - General 19 10-31-2007 08:26 PM
cron backup job not running dsschanze Linux - General 9 07-29-2005 08:47 PM
cron job - backup medamnit Linux - Newbie 4 05-24-2002 03:37 AM


All times are GMT -5. The time now is 03:33 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration