LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
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 10-10-2007, 10:11 AM   #1
carlosinfl
Senior Member
 
Registered: May 2004
Location: Orlando, FL
Distribution: Arch
Posts: 2,905

Rep: Reputation: 77
RSYNC Not Working


Guys - I set up 7.04 to sync my home directory with an external usb drive every 5 minutes. I have added a new file to my home directory and it has yet to show up on /media/disk for the past hour and I don't understand why. The RSYNC is setup via CRON to run every 5 minutes so this makes no sense to me...

Can anyone please tell me what is wrong?

Here is my RSYNC command in crontab.

Code:
cwilliams@cwilliams:~$ crontab -l
# m h  dom mon dow   command
5 * * * * rsync --delete -rdtvu /home/cwilliams/ /media/disk
cwilliams@cwilliams:~$ ls
BEWS_11D.7170_LINUX-UNIX-MAC-NT4_AGENTS.2.tar.gz  idelab revised 8-8-06.vsd  permission.txt   wallpaper
contact.txt                                       linux_commands.txt         phonelist.txt    whitelist.txt
contact.txt~                                      mailman.txt                spam_lookup.txt  whitelist.txt~
create_calendar.txt                               mysql.txt                  stricom_vlk.txt
Desktop                                           old_users                  symantec
cwilliams@cwilliams:~$ ls /media/disk/
contact.txt          Desktop                    mailman.txt  permission.txt   stricom_vlk.txt  whitelist.txt
contact.txt~         idelab revised 8-8-06.vsd  mysql.txt    phonelist.txt    symantec         whitelist.txt~
create_calendar.txt  linux_commands.txt         old_users    spam_lookup.txt  wallpaper
As you can see /media/disk is missing the BEWS* tarball that is present in /home/cwilliams. That file has been there for two hours.
 
Old 10-10-2007, 11:24 AM   #2
pronoy
Member
 
Registered: Mar 2005
Location: india
Distribution: FC4, Debian Etch
Posts: 67

Rep: Reputation: Disabled
It is working if you run the command directly from the command line?
Not sure, since the command will run in every 5 mins, they may get overlapped if the first command is not complete by that time.
 
Old 10-10-2007, 11:31 AM   #3
carlosinfl
Senior Member
 
Registered: May 2004
Location: Orlando, FL
Distribution: Arch
Posts: 2,905

Original Poster
Rep: Reputation: 77
I can run the command manually which takes less than 4 seconds to run so I can't see it being overlapped in a 5 minute interval. When I run it manually the sync happens right away so I think the issue is cron or perhaps it does not like something but I have no idea what that is...

Code:
cwilliams@cwilliams:/share$ rsync --delete -rdtvu /home/cwilliams/ /media/disk
building file list ... done
deleting .mozilla/firefox/uj02mrmu.default/Cache/D36A5345d01
deleting .mozilla/firefox/uj02mrmu.default/Cache/904E844Dd01
deleting .mozilla/firefox/uj02mrmu.default/Cache/8D697FAEd01
./
skipping non-regular file ".DCOPserver_cwilliams_:0"
rsync: send_files failed to open "/home/cwilliams/.viminfo": Permission denied (13)
.gconf/apps/nautilus/preferences/
.gconf/apps/nautilus/preferences/%gconf.xml
skipping non-regular file ".kde/cache-cwilliams"
skipping non-regular file ".kde/socket-cwilliams"
skipping non-regular file ".kde/tmp-cwilliams"
skipping non-regular file ".mozilla-thunderbird/evcd6ud0.default/lock"
.mozilla-thunderbird/evcd6ud0.default/panacea.dat
.mozilla-thunderbird/evcd6ud0.default/ImapMail/mail.ideorlando.org/INBOX.msf
.mozilla-thunderbird/evcd6ud0.default/ImapMail/mail.ideorlando.org/Sent-1.msf
.mozilla-thunderbird/evcd6ud0.default/ImapMail/mail.ideorlando.org/Trash.msf
.mozilla-thunderbird/evcd6ud0.default/ImapMail/mail.ideorlando.org/INBOX.sbd/Logs.sbd/LT2FS2.msf
.mozilla/firefox/uj02mrmu.default/
.mozilla/firefox/uj02mrmu.default/cookies.txt
.mozilla/firefox/uj02mrmu.default/history.dat
skipping non-regular file ".mozilla/firefox/uj02mrmu.default/lock"
.mozilla/firefox/uj02mrmu.default/sessionstore.js
.mozilla/firefox/uj02mrmu.default/urlclassifier2.sqlite
.mozilla/firefox/uj02mrmu.default/Cache/
.mozilla/firefox/uj02mrmu.default/Cache/B0F65723d01
.mozilla/firefox/uj02mrmu.default/Cache/_CACHE_001_
.mozilla/firefox/uj02mrmu.default/Cache/_CACHE_002_
.mozilla/firefox/uj02mrmu.default/Cache/_CACHE_003_
.nautilus/metafiles/
.nautilus/metafiles/file:%2F%2F%2Fhome%2Fcwilliams.xml
skipping non-regular file ".openoffice.org2/user/config/arrowhd_en-GB.soe"
skipping non-regular file ".openoffice.org2/user/config/arrowhd_en-US_en-ZA.soe"
skipping non-regular file ".openoffice.org2/user/config/classic_en-GB.sog"
skipping non-regular file ".openoffice.org2/user/config/classic_en-US_en-ZA.sog"
skipping non-regular file ".openoffice.org2/user/config/hatching_en-GB.soh"
skipping non-regular file ".openoffice.org2/user/config/hatching_en-US_en-ZA.soh"
skipping non-regular file ".openoffice.org2/user/config/modern_en-GB.sog"
skipping non-regular file ".openoffice.org2/user/config/modern_en-US_en-ZA.sog"
skipping non-regular file ".openoffice.org2/user/config/palette_en-GB.soc"
skipping non-regular file ".openoffice.org2/user/config/palette_en-US_en-ZA.soc"
skipping non-regular file ".openoffice.org2/user/config/styles_en-GB.sod"
skipping non-regular file ".openoffice.org2/user/config/styles_en-US_en-ZA.sod"
zoo/

sent 21879479 bytes  received 408 bytes  43759774.00 bytes/sec
total size is 19473598011  speedup is 890.02
rsync error: some files could not be transferred (code 23) at main.c(977) [sender=2.6.9]
Above is the verbose output of my RSYNC command and it has permission errors on some folders which I don't care about. Can I exclude any files and or folders that are hidden? How would I execute that into my RSYNC command to leave out hidden files / folders?
 
Old 10-10-2007, 12:00 PM   #4
tredegar
LQ 5k Club
 
Registered: May 2003
Location: London, UK
Distribution: Fedora38
Posts: 6,147

Rep: Reputation: 435Reputation: 435Reputation: 435Reputation: 435Reputation: 435
cron usually needs the full path to an executable. So try this:
Code:
5 * * * * /usr/bin/rsync --delete -rdtvu /home/cwilliams/ /media/disk
 
Old 10-10-2007, 04:02 PM   #5
trickykid
LQ Guru
 
Registered: Jan 2001
Posts: 24,149

Rep: Reputation: 269Reputation: 269Reputation: 269
Yes, put the full path. It's a good rule of thumb to always put the full path to an executable or script as the path might not always in the user who's running it own path. Make it a habit from now on.
 
Old 10-10-2007, 06:05 PM   #6
carlosinfl
Senior Member
 
Registered: May 2004
Location: Orlando, FL
Distribution: Arch
Posts: 2,905

Original Poster
Rep: Reputation: 77
Quote:
Originally Posted by trickykid View Post
Yes, put the full path. It's a good rule of thumb to always put the full path to an executable or script as the path might not always in the user who's running it own path. Make it a habit from now on.
Thanks - will do so for now on! As for if that was the problem or not, I don't know. I will post back after I look at some time stamps and diff the two destination and source folders.

To be continued...
 
Old 10-12-2007, 02:59 PM   #7
carlosinfl
Senior Member
 
Registered: May 2004
Location: Orlando, FL
Distribution: Arch
Posts: 2,905

Original Poster
Rep: Reputation: 77
OK so I have updated my cron job to read as follows:

Code:
cwilliams@cwilliams:~$ crontab -l
# m h  dom mon dow   command
5 * * * * /usr/bin/rsync --delete -rdtvu /home/cwilliams/ /media/disk
I waited 5 minutes and never saw the file sync over to /media/disk however at some point with in the next hour or less the file will sync to /media/disk so my question is why is the sync not occurring every 5 minutes. Where can I check for errors and or issues that perhaps are not being visible.

**EDIT***

Exactly at 4:05 pm according to my system time, the sync went through so is there something wrong with my cron entry as to not syncing every 5 minutes?

Last edited by carlosinfl; 10-12-2007 at 03:06 PM.
 
Old 10-12-2007, 03:11 PM   #8
cygnus-x1
Member
 
Registered: Jul 2006
Location: Crisfield
Distribution: Slackware, CentOS, RedHat
Posts: 159

Rep: Reputation: 15
Quote:
Originally Posted by Carlwill View Post
OK so I have updated my cron job to read as follows:

Code:
cwilliams@cwilliams:~$ crontab -l
# m h  dom mon dow   command
5 * * * * /usr/bin/rsync --delete -rdtvu /home/cwilliams/ /media/disk
I waited 5 minutes and never saw the file sync over to /media/disk however at some point with in the next hour or less the file will sync to /media/disk so my question is why is the sync not occurring every 5 minutes. Where can I check for errors and or issues that perhaps are not being visible.

**EDIT***

Exactly at 4:05 pm according to my system time, the sync went through so is there something wrong with my cron entry as to not syncing every 5 minutes?
Shouldn't your rsync be ??

*/5 * * * *

I think just saying 5 means 5 minutes after some hour which you do not have defined. If you had

5 10 * * *

This would say do this job at 10:05

I think I have this correct
 
Old 10-12-2007, 04:09 PM   #9
carlosinfl
Senior Member
 
Registered: May 2004
Location: Orlando, FL
Distribution: Arch
Posts: 2,905

Original Poster
Rep: Reputation: 77
Thanks because I am very sure that its now running 5 past every hour every day. I will fix it. Thanks!
 
Old 10-14-2007, 07:37 AM   #10
trickykid
LQ Guru
 
Registered: Jan 2001
Posts: 24,149

Rep: Reputation: 269Reputation: 269Reputation: 269
Quote:
Originally Posted by Carlwill View Post
Thanks because I am very sure that its now running 5 past every hour every day. I will fix it. Thanks!
Heh, I didn't even notice the discrepancy myself. You did in fact have it set to run 5 minutes after each hour.
 
Old 10-14-2007, 08:02 AM   #11
tredegar
LQ 5k Club
 
Registered: May 2003
Location: London, UK
Distribution: Fedora38
Posts: 6,147

Rep: Reputation: 435Reputation: 435Reputation: 435Reputation: 435Reputation: 435
Beware:
You seem to be wanting to make a backup of your home to an external disk every so often.
OK. Nice idea
But you have rsync with the --delete option. Now, suppose you deleted a file from your home by mistake. Your cron job runs, the directories are synced and the file is also deleted from your "backup". Whoops! The file is truly gone.
This may not be what you want to achieve
 
Old 10-15-2007, 02:17 PM   #12
cygnus-x1
Member
 
Registered: Jul 2006
Location: Crisfield
Distribution: Slackware, CentOS, RedHat
Posts: 159

Rep: Reputation: 15
Quote:
Originally Posted by tredegar View Post
Beware:
You seem to be wanting to make a backup of your home to an external disk every so often.
OK. Nice idea
But you have rsync with the --delete option. Now, suppose you deleted a file from your home by mistake. Your cron job runs, the directories are synced and the file is also deleted from your "backup". Whoops! The file is truly gone.
This may not be what you want to achieve
Well he does live dangerously. Even his sig line has 'rm -rf /' =)

Yes do be careful with --delete. It can be a good thing to have if you have a rolling backup system in place where you keep daily backup sets in different directories otherwise I would NOT include --delete.
 
Old 10-19-2007, 08:26 AM   #13
carlosinfl
Senior Member
 
Registered: May 2004
Location: Orlando, FL
Distribution: Arch
Posts: 2,905

Original Poster
Rep: Reputation: 77
Yes - I am very careful when I remove something from my home folder simply because I want the --delete option to avoid useless clutter on my external drive. Thanks for the warning however.

Now my question is how do I avoid the RSYNC to copy over hidden files and folders from my home dire to my external drive? I am also copying a bunch of useless system data that are profile or system dependant. They all begin with a .* so I would assume I can do some kind of --exclude command in there but I don't know what the command should look like. I don't want to mess anything up if you know what I mean.

Anyone have any ideas?
 
Old 10-24-2007, 01:10 PM   #14
carlosinfl
Senior Member
 
Registered: May 2004
Location: Orlando, FL
Distribution: Arch
Posts: 2,905

Original Poster
Rep: Reputation: 77
Anyone have any ideas how to run this rsync w/o or excluding the hidden files and directories?
 
  


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



Similar Threads
Thread Thread Starter Forum Replies Last Post
rsync ,rcp not working-Connection refused! jimmyjiang Linux - Networking 2 09-17-2008 04:34 AM
Protocols (rsync, ssh, nfs, ipp) working only in one direction hroit Linux - General 8 08-23-2007 03:27 PM
rcp and rsync not working at all veyden Linux - Networking 19 12-14-2005 10:08 AM
rsync & scponlyc shell: not working hamish Linux - Software 3 05-28-2005 07:15 AM
rsync password-file not working kmoffat Slackware 6 08-02-2004 10:41 PM

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

All times are GMT -5. The time now is 03:50 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