LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 06-04-2009, 11:26 AM   #1
akadzban
LQ Newbie
 
Registered: Jun 2009
Location: Chicago, IL
Posts: 6

Rep: Reputation: 0
cron problems


Hey all, I'm trying to use snapback2 to do automatic backups of a machine I've got running with about 1.1TB (~1.2 million files) of data on it onto another machine. I got it set up, and it works if I call snapback2 from the command line, however I'm trying to get it to run automatically as a cron job, which doesn't work. The crontab entry is "30 22 * * * snapback2 -d", which is exactly the same as when I call it manually (snapback2 -d) [-d is debug mode].

I checked some logs, and the call to rsync (which snapback2 makes) is exactly the same in both cases. So why does the cron job fail? I know cron runs once every minute, though I'm not familiar with the lower level workings. The only thing I can think of is that since the rsync call takes longer than a minute, something is cutting it off, hence the failures. Is this reasonable? I can restructure how the backup occurs (i.e. ~10 smaller backups of individual folders instead of one gigantic recursive backup), however it takes something like 2 days for the initial backup to be created (transferring over the net), so I don't want to wait around for that to happen if it wouldn't likely fix the problem.

I can post logs and more info if you think my idea isn't correct, just let me know.
 
Old 06-04-2009, 12:45 PM   #2
mdg
Member
 
Registered: Sep 2003
Distribution: Slackware
Posts: 626

Rep: Reputation: 38
Try specifying the full path to snapback2. cron works in a limited environment, it might not be able to access the command without the full path.
 
Old 06-04-2009, 01:00 PM   #3
akadzban
LQ Newbie
 
Registered: Jun 2009
Location: Chicago, IL
Posts: 6

Original Poster
Rep: Reputation: 0
Well it makes the call to snapback2, snapback2 just fails when it calls rsync. I'll try it with the full path though...yeah, still fails.

Does cron perhaps not play well with ssh keys? I'm using them for the remote login (the machine I'm backing up is off site)
 
Old 06-04-2009, 01:03 PM   #4
repo
LQ 5k Club
 
Registered: May 2001
Location: Belgium
Distribution: Arch
Posts: 8,529

Rep: Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899
what are the error messages?
You also need to provide the whole path to all the commands in the script.
 
Old 06-04-2009, 01:08 PM   #5
akadzban
LQ Newbie
 
Registered: Jun 2009
Location: Chicago, IL
Posts: 6

Original Poster
Rep: Reputation: 0
The snapback2 log message is

Code:
2009-06-04 12:55:01  FAILED with status 255:
command was: rsync -v -z -e 'ssh' -a --force --delete-excluded  --one-file-system --delete --exclude="core.*" --link-dest=../hourly.1 drosophila.biol.iit.edu:/home/ /home/tomlab/drosophila_backup//drosophila.biol.iit.edu/home/hourly.0
Also FYI, that rsync call is made at the end of a long list of other calls, so I know snapback2 isn't just straight up failing.

Edit:
I just checked the /var/mail log, and here's the mail I got for the last time I ran it: http://pastebin.com/m20c06a10

It now looks to me like it's something with SSH. Though I have keys generated as both my user and as root, both on the remote machine. And it still works if I just manually call snapback2...so what is cron doing that's breaking ssh?

Last edited by akadzban; 06-04-2009 at 02:21 PM.
 
Old 06-04-2009, 11:07 PM   #6
akadzban
LQ Newbie
 
Registered: Jun 2009
Location: Chicago, IL
Posts: 6

Original Poster
Rep: Reputation: 0
I figured it out. cron wasn't picking up an environment variable that SSH needed, so SSH authentication was failing. I set up a script to export that variable and then call snapback2, and cron now calls that script instead of just calling snapback2.
 
  


Reply


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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
adding a perl script to cron.daily / cron.d to setup a cron job CrontabNewBIE Linux - Software 6 01-14-2008 08:16 AM
cron not working from crontab nor form /etc/cron/cron.d. What did SuSE change? JZL240I-U SUSE / openSUSE 11 01-04-2007 01:57 AM
Problems with cron mark8569 Linux - Software 8 12-10-2006 11:38 PM
Having problems with cron Smaks Linux - Software 4 10-07-2006 12:26 PM
Can any one plz explain why/what for cron.d, cron.daily, cron.weekly etc are there. mavinashbabu Linux - Newbie 4 09-21-2006 01:50 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 05:52 PM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration