![]() Sudo chmod +x /home/your-username/Desktop/rsync-shell.sh Save myrsync.sh in your ~$HOME and make it executable by typing: ![]() Note that `rsync` will name every sync differently based on day/time of sync Change this to whatever your backup location is. media/dataBackup_$(date +%Y%m%d_%T) is the separate drive. home/data copies the directory and its contents, /home/data would just copy the contents. home/data is the directory I want copied. exclude leaves out any files or directories you don't want copied. log-file saves a copy of the rsync result to a date-stamped file on my desktop. delete checks for changes between source and destination, and deletes any files at the destination that you've deleted at the source. progress gives you more specific info about progress. 'v' is verbose, so it tells you what its doing, either in the terminal, in this case, in the log file. Meaning of the flags: -av bit: 'a' means archive, or copy everything recursively, preserving things like permissions, ownership and time stamps. Sudo rsync -av -progress -delete -log-file=/home/your-username/Desktop/$(date +%Y%m%d) rsync.log -exclude "/home/your-username/.folder" /home/data /media/dataBackup$(date +%Y%m%d_%T) Ĭreate your script: create new file and call it myrsync.sh, copy/paste the lines below: I just don't currently have a NetApp NAS. Update: After some more Googling, I've discovered that NetApp creates the snapshot folders. I don't understand how to automatically rename the folders as time goes on (ie weekly1 to weekly2), or how to delete "week10" if I decide to only keep weeks up to 9. Somehow move hourly0 to hourly1 before running the scheduled hourly rsyncĭelete the oldest backup once rsync completes successfullyĪre there any guides that cover how to do this? Use crontab to schedule the rsync command at the desired backup interval Change the permissions on the script to make it executable. ![]() Sudo rsync -av -progress -delete -log-file=/home/username/$(date +%Y%m%d)_rsync.log -exclude "/home/username/.snapshot" /home/username/ /home/username/.snapshot/hourly1 Create a shell script to execute the rsync command.Use rsync to copy the contents of a given folder to the remote host, NAS, or (~/.snapshot/hourly0).I have seen several related posts on stack overflow, but so far, I haven't seen a guide that explains the complete workflow. It's just nice to have the ability to recover a file from yesterday or this morning if you don't like the changes that have been made. It's not a backup for the purpose of guarding against hardware failure. The /home/username/.snapshot/ directory would be read-only by the user. snapshot folder in the user's home directory (~/.snapshot/) that holds hourly, nightly, and weekly backups of their home directory (ie ~/.snapshot/weekly1 for a copy of what was in the user's home directory 1 week ago). I'm looking for how to automatically backup a user's home directory in CentOs 7 to a remote host or NAS or just to ~/.snapshot.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |