LinuxQuestions.org
Visit Jeremy's Blog.
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 07-14-2009, 09:12 AM   #1
rjo98
Senior Member
 
Registered: Jun 2009
Location: US
Distribution: RHEL, CentOS
Posts: 1,668

Rep: Reputation: 46
rsync's in crontab not running, not sure why


Hi guys. Now I truly do have my first problem. There is a crontab setup that has some rsync's in it. Well when I look at the free space in the source and destination directory, they don't match after the rsync (which has a --delete in it).

could my crontab be turned off? or could rsync just be failing?
 
Old 07-14-2009, 09:14 AM   #2
schneidz
LQ Guru
 
Registered: May 2005
Location: boston, usa
Distribution: fc-15/ fc-20-live-usb/ aix
Posts: 5,027

Rep: Reputation: 845Reputation: 845Reputation: 845Reputation: 845Reputation: 845Reputation: 845Reputation: 845
^ what is the contents of your crontab ?

could you redirect stdout and stderr to some log file ?

Last edited by schneidz; 07-14-2009 at 09:15 AM.
 
Old 07-14-2009, 09:14 AM   #3
tredegar
LQ 5k Club
 
Registered: May 2003
Location: London, UK
Distribution: Debian "Jessie"
Posts: 6,085

Rep: Reputation: 398Reputation: 398Reputation: 398Reputation: 398
Please post your crontab "rsync's"
 
Old 07-14-2009, 09:22 AM   #4
rjo98
Senior Member
 
Registered: Jun 2009
Location: US
Distribution: RHEL, CentOS
Posts: 1,668

Original Poster
Rep: Reputation: 46
Here is the line that I know isn't working by comparing directory sizes.


05 02 * * 2,4,6 rsync -r -a -p --delete /data1/stuff /data2/stuffbackup/
 
Old 07-14-2009, 09:32 AM   #5
tredegar
LQ 5k Club
 
Registered: May 2003
Location: London, UK
Distribution: Debian "Jessie"
Posts: 6,085

Rep: Reputation: 398Reputation: 398Reputation: 398Reputation: 398
cron's $PATH is very limited, or non-existant so you need to give the /full/path/to/rsync
Code:
tred@vaio:~$ which rsync
/usr/bin/rsync
tred@vaio:~$
So for me I'd put:
Code:
05 02 * * 2,4,6 /usr/bin/rsync -r -a -p --delete /data1/stuff /data2/stuffbackup/
and see if that worked better.
 
Old 07-14-2009, 09:34 AM   #6
repo
LQ 5k Club
 
Registered: May 2001
Location: Belgium
Distribution: Arch
Posts: 8,527

Rep: Reputation: 898Reputation: 898Reputation: 898Reputation: 898Reputation: 898Reputation: 898Reputation: 898
Also, cron will sent a mail to root in case of problems.
 
Old 07-14-2009, 09:37 AM   #7
rjo98
Senior Member
 
Registered: Jun 2009
Location: US
Distribution: RHEL, CentOS
Posts: 1,668

Original Poster
Rep: Reputation: 46
How do I check the mail to see if there was a problem?
 
Old 07-14-2009, 09:43 AM   #8
repo
LQ 5k Club
 
Registered: May 2001
Location: Belgium
Distribution: Arch
Posts: 8,527

Rep: Reputation: 898Reputation: 898Reputation: 898Reputation: 898Reputation: 898Reputation: 898Reputation: 898
login as root, and type
mail

Best is to change the root mail in /etc/aliases
Code:
nano /etc/aliases
change
Code:
root:root
to
Code:
root:your-username
So all mail for root will be sent to your user account.

BTW, adding the path in cron, as tredegar suggested, should solve the problem
 
Old 07-14-2009, 09:48 AM   #9
rjo98
Senior Member
 
Registered: Jun 2009
Location: US
Distribution: RHEL, CentOS
Posts: 1,668

Original Poster
Rep: Reputation: 46
OK, my next dumb question is how do i edit the crontab to add the path in?

the rsync's worked before without the path, or so i'm told. did maybe a redhat update break that?
 
Old 07-14-2009, 09:51 AM   #10
repo
LQ 5k Club
 
Registered: May 2001
Location: Belgium
Distribution: Arch
Posts: 8,527

Rep: Reputation: 898Reputation: 898Reputation: 898Reputation: 898Reputation: 898Reputation: 898Reputation: 898
If you are the owner of the crontab
Code:
crontab -e
 
Old 07-14-2009, 09:51 AM   #11
centosboy
Senior Member
 
Registered: May 2009
Location: london
Distribution: centos5
Posts: 1,137

Rep: Reputation: 116Reputation: 116
Quote:
Originally Posted by rjo98 View Post
OK, my next dumb question is how do i edit the crontab to add the path in?

the rsync's worked before without the path, or so i'm told. did maybe a redhat update break that?
Code:
crontab -e
presuming it is the current users crontab.

for messages/errors, check the email address that cron sends alerts to.
also check the /var/log/cron file to see if the job has been running succesfully
 
Old 07-14-2009, 09:51 AM   #12
rjo98
Senior Member
 
Registered: Jun 2009
Location: US
Distribution: RHEL, CentOS
Posts: 1,668

Original Poster
Rep: Reputation: 46
ok, thanks. then i just do a wq to exit out of it?
 
Old 07-14-2009, 09:53 AM   #13
repo
LQ 5k Club
 
Registered: May 2001
Location: Belgium
Distribution: Arch
Posts: 8,527

Rep: Reputation: 898Reputation: 898Reputation: 898Reputation: 898Reputation: 898Reputation: 898Reputation: 898
Quote:
ok, thanks. then i just do a wq to exit out of it?
Depends which editor you use
for vi wq
 
Old 07-14-2009, 09:53 AM   #14
centosboy
Senior Member
 
Registered: May 2009
Location: london
Distribution: centos5
Posts: 1,137

Rep: Reputation: 116Reputation: 116
Quote:
Originally Posted by rjo98 View Post
ok, thanks. then i just do a wq to exit out of it?
it opens in the default current editor.
 
Old 07-14-2009, 09:54 AM   #15
centosboy
Senior Member
 
Registered: May 2009
Location: london
Distribution: centos5
Posts: 1,137

Rep: Reputation: 116Reputation: 116
grrr...repo always quicker then me
 
  


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



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to see that crontab is running or not. nirmalraja Linux - General 1 11-23-2006 03:30 AM
can't understand rsync's behavior at all baronsam Linux - Software 5 08-15-2006 02:46 PM
crontab jobs aren't running mdm_linux Linux - General 4 05-30-2005 01:27 PM
Running ssh from crontab cmfarley19 Linux - Software 1 01-23-2004 09:24 AM
Old Crontab still Running vwaldoguy Linux - Software 3 08-05-2003 03:50 AM


All times are GMT -5. The time now is 01:49 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration