Linux - GeneralThis 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
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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...
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.
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...
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?
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.
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.
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.
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
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
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.
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.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.