LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
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, 08:12 AM   #1
anon091
Senior Member
 
Registered: Jun 2009
Posts: 1,795

Rep: Reputation: 49
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, 08:14 AM   #2
schneidz
LQ Guru
 
Registered: May 2005
Location: boston, usa
Distribution: fedora-35
Posts: 5,313

Rep: Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918
^ 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 08:15 AM.
 
Old 07-14-2009, 08:14 AM   #3
tredegar
LQ 5k Club
 
Registered: May 2003
Location: London, UK
Distribution: Fedora38
Posts: 6,147

Rep: Reputation: 435Reputation: 435Reputation: 435Reputation: 435Reputation: 435
Please post your crontab "rsync's"
 
Old 07-14-2009, 08:22 AM   #4
anon091
Senior Member
 
Registered: Jun 2009
Posts: 1,795

Original Poster
Rep: Reputation: 49
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, 08:32 AM   #5
tredegar
LQ 5k Club
 
Registered: May 2003
Location: London, UK
Distribution: Fedora38
Posts: 6,147

Rep: Reputation: 435Reputation: 435Reputation: 435Reputation: 435Reputation: 435
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, 08:34 AM   #6
repo
LQ 5k Club
 
Registered: May 2001
Location: Belgium
Distribution: Arch
Posts: 8,529

Rep: Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899
Also, cron will sent a mail to root in case of problems.
 
Old 07-14-2009, 08:37 AM   #7
anon091
Senior Member
 
Registered: Jun 2009
Posts: 1,795

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

Rep: Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899
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, 08:48 AM   #9
anon091
Senior Member
 
Registered: Jun 2009
Posts: 1,795

Original Poster
Rep: Reputation: 49
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, 08:51 AM   #10
repo
LQ 5k Club
 
Registered: May 2001
Location: Belgium
Distribution: Arch
Posts: 8,529

Rep: Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899
If you are the owner of the crontab
Code:
crontab -e
 
Old 07-14-2009, 08: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, 08:51 AM   #12
anon091
Senior Member
 
Registered: Jun 2009
Posts: 1,795

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

Rep: Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899
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, 08: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, 08: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



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 02:30 AM
can't understand rsync's behavior at all baronsam Linux - Software 5 08-15-2006 01:46 PM
crontab jobs aren't running mdm_linux Linux - General 4 05-30-2005 12:27 PM
Running ssh from crontab cmfarley19 Linux - Software 1 01-23-2004 08:24 AM
Old Crontab still Running vwaldoguy Linux - Software 3 08-05-2003 02:50 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 08:43 AM.

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