Тёмный

Easy rsync Backup with tar and cron (daily, weekly, monthly) 

Tony Teaches Tech
Подписаться 104 тыс.
Просмотров 47 тыс.
50% 1

Lean how to use rsync, tar, and cron to setup a daily, weekly, and monthly backup on Linux. In this tutorial, we will backup a WordPress website, but this script can be modified to backup any directory or files.
Code snippets and more at tonyteaches.tech/rsync-backup...
Check out my vlog channel ‪@TonyFlorida‬
#rsync #cron #tar #backup #crontab #cronjob

Хобби

Опубликовано:

 

28 мар 2021

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 93   
@petewarby7158
@petewarby7158 10 месяцев назад
I've spent so long looking for some of the contents of this tutorial online and found it here in one place. 2nd of your videos that I've found that have absolutely NAILED what I needed to know. Awesome tutorial, thank you.
@TonyTeachesTech
@TonyTeachesTech 10 месяцев назад
You're very welcome!
@VANTYCSolutions
@VANTYCSolutions 7 месяцев назад
Thank you so much, the best 22 minutes invested.
@nwdsc
@nwdsc 7 месяцев назад
Great video. I used this for many months but recently wrote a new script. I just have one script rather than three. In that script it runs the daily every day and then uses if-then to check if it's Friday, it COPIES the day file to the weekly folder. If it's the first day of the month, then it copies the day file to the monthly folder. That way you don't run the whole archive three separate times and only one cron job. The rest is totally based on your tutorial. Thanks so much.
@qwarlockz8017
@qwarlockz8017 3 года назад
Really nice video covering useful simple scripting! Sweet!
@TonyTeachesTech
@TonyTeachesTech 3 года назад
Thanks!
@adooken1019
@adooken1019 10 месяцев назад
This is gold. Amazing presentation of information ! You would make a great teacher
@TonyTeachesTech
@TonyTeachesTech 10 месяцев назад
Glad it was helpful! Subscribe if you haven't already done so 🙏
@fedepetit
@fedepetit 2 года назад
Very nice tutorial, specially for those of us who know little about Linux. This method implies you have enough space in the source to make the compressed backups to transfer to destination.
@TonyTeachesTech
@TonyTeachesTech 2 года назад
Thanks!
@seenivasantamilmani9944
@seenivasantamilmani9944 Месяц назад
Awesome man❤... Really helpful
@lakshmisowjanya9492
@lakshmisowjanya9492 Год назад
Excellent tutorial Exactly matched to my scenario Thank you so much
@TonyTeachesTech
@TonyTeachesTech Год назад
Great to hear!
@jeucedahn
@jeucedahn 10 месяцев назад
Very well explain video!! Thanks for sharing!
@frankgarcia4644
@frankgarcia4644 4 месяца назад
Awesome video. Thank you for your explanations and details.
@josh_muti
@josh_muti Год назад
great video. excellent explanation
@angelozou3914
@angelozou3914 Год назад
Thank you for your video. Usefully.
@jehad2322
@jehad2322 Год назад
Thank you for a great tutorial.
@TonyTeachesTech
@TonyTeachesTech Год назад
You are welcome!
@ldinoc8087
@ldinoc8087 3 года назад
Great job and best explanation
@TonyTeachesTech
@TonyTeachesTech 3 года назад
Thanks!
@N0AGI
@N0AGI 2 года назад
well done - thanks for sharing.
@laci272
@laci272 3 года назад
Great video. I did need it. Thanks for doing the research (and for the videos)
@TonyTeachesTech
@TonyTeachesTech 3 года назад
No problem!
@MadRobDestroyer
@MadRobDestroyer 9 месяцев назад
Amazing thank you for this. Very good explanations.
@viveknayak
@viveknayak 3 года назад
thanks for the date command, I used to do that manually before
@TonyTeachesTech
@TonyTeachesTech 3 года назад
You're welcome Vivek
@AmitAnand14
@AmitAnand14 2 года назад
Really what I was looking for......👍
@TonyTeachesTech
@TonyTeachesTech 2 года назад
Great
@mattd4559
@mattd4559 8 дней назад
Great video, thanks for your help
@TonyTeachesTech
@TonyTeachesTech 5 дней назад
No problem 👍
@mason8714
@mason8714 Год назад
great video! perfect for what i need - also subscribed
@picnicsinspace198
@picnicsinspace198 2 года назад
Thank you :) youre awesome
@TonyTeachesTech
@TonyTeachesTech 2 года назад
You’re welcome!
@isaargentina4495
@isaargentina4495 Год назад
Owesome!, you really helped me. Thank you so much.
@TonyTeachesTech
@TonyTeachesTech Год назад
Sure thing!
@chromerims
@chromerims 10 месяцев назад
Nice video on tar, rsync and crontab 👍 I shall try the script but also experimenting with piping each of the commands into grep error and further piping into either touch error or cat > error-$(date +%Y%m%d), all in order to gate the steps and log errors. Also I shall experiment with creating tar.gz files onto a labile ram disk. Maybe better for speed and wear. Dunno. Kindest regards, friends and neighbours.
@bappelzoller1817
@bappelzoller1817 2 года назад
Very nice! Your a great teacher ~~ easy to follow :-) It helped me Thank you
@TonyTeachesTech
@TonyTeachesTech 2 года назад
Thanks!
@heel57
@heel57 Год назад
thanks for offering this video. Would have been perfect if you also included the restore process.
@raul230285
@raul230285 2 года назад
Excelent..!! saludos desde Perú..!! Theacher
@jamesmichaels4209
@jamesmichaels4209 2 года назад
very nice thanks
@TonyTeachesTech
@TonyTeachesTech 2 года назад
Thanks James
@pankajdeshmukh6565
@pankajdeshmukh6565 3 года назад
Thanks bro
@TonyTeachesTech
@TonyTeachesTech 3 года назад
Sure thing
@mosesotieno1629
@mosesotieno1629 Год назад
Clearly explained! Thanks! Any idea backing up to Google drive?
@clivewi9103
@clivewi9103 2 года назад
A good video; I was wondering why you used three scripts when one would have done the job, and you could have avoided the problem of the rsync command running before tar had completed its task? I was also wondering because you have created the three scripts why you didn't move the scripts into the crontab directory structure where jobs are run daily etc. I agree with Anders A you really need some logging so perhaps make a follow on video to show how you add logging into the script.
@stlouisphotography
@stlouisphotography 2 года назад
Cool!
@TonyTeachesTech
@TonyTeachesTech 2 года назад
:)
@sjgsteve21
@sjgsteve21 Год назад
What if you only want to backup changes to your directory. Presumably tar is not what you need to use for this? Eg if I want to backup my entire Plex library for redundancy purposes.
@HamzaTrichi-yt1zz
@HamzaTrichi-yt1zz Год назад
Shuouldn't you execute the rsync command at 01:00 AM for example, to make sure that all the backups are made before moving them?
@mauwiks
@mauwiks 2 года назад
can you explain the options
@mauwiks
@mauwiks 2 года назад
how about we make a filename as the username of the account + date
@jeremiahbullfrog9288
@jeremiahbullfrog9288 Год назад
I never remember about the -C tar flag... what a handy option.
@jeremiahbullfrog9288
@jeremiahbullfrog9288 Год назад
Never knew that you could so easily cull old files with a simple find option
@jeremiahbullfrog9288
@jeremiahbullfrog9288 Год назад
Not a fan of blanket passwordless root access via ssh keys.. will you address this? 9 more minutes, maybe that'll be in part 2
@jeremiahbullfrog9288
@jeremiahbullfrog9288 Год назад
I don't understand the bit about deleting and then "oops no we actually need that because [unintelligible]"
@jeremiahbullfrog9288
@jeremiahbullfrog9288 Год назад
I love the stream-of-consciousness motif where you show the mistakes like "backup" vs "backups" and checking in realtime whether the cron job is calling the correct path.
@jeremiahbullfrog9288
@jeremiahbullfrog9288 Год назад
Looks like a workable backup solution with minimal fuss, thanks for sharing your expertise. Subscribe.
@JunyueWang-vc9we
@JunyueWang-vc9we Год назад
Great Great videos! actually how to include the password option in script without using public key? Appreciate in advance!!
@louisgamor
@louisgamor 3 года назад
Awesome video....loved every bit of it😍👍 Is there any reason why there is a space between the 'var/www' and the 'html' directories?
@TonyTeachesTech
@TonyTeachesTech 3 года назад
Oh for this command? tar -zcf /home/tony/backup/monthly/backup-$(date +%Y%m%d).tar.gz -C /var/www/ html The -C flag means to change to the /var/www directory and the html argument is the directory that we want to archive
@louisgamor
@louisgamor 3 года назад
@@TonyTeachesTech Awesome...thanks a million 🤗
@angeltysonswe
@angeltysonswe 2 года назад
Is there any reason as to why run multiple tar arguments for monthly and weekly? Couldn't they just include an copy or hardlink command to the tar file that the daily script creates at that point? And in so decreasing the harddrive usage and decreasing CPU usage as you don't have to compress your files so many times?
@TonyTeachesTech
@TonyTeachesTech 2 года назад
That sounds like a valid point. In no way was I considering efficiency in this tutorial. Thanks!
@SchwarzerCorsaR
@SchwarzerCorsaR Год назад
If you think of huge amounts of data, it might well happen that you‘re running out of allocated time for backuping. I modified you‘re (else great!) tutorial to just copy once a week / month / year. A link wouldn‘t do the trick as the intention is to maintain older backup versions.
@actng
@actng Год назад
how do i take an image of the entire linux server and restore it later?
@andreasmoller732
@andreasmoller732 2 года назад
Hello. when I use find delete command +3 it does not want to delete any files but when I use -3 it deletes new files ... I have files in the folder that are older than 3 days but they do not work .... find /mnt/exe/backups/nextcloud-db/* -mtime +3 -delete
@TonyTeachesTech
@TonyTeachesTech 2 года назад
I think you understand this, but just to make sure the +/- depends on when the files were created i.e. timestamp
@philipnwosu3691
@philipnwosu3691 2 года назад
Put Caveat on the --delete command
@TonyTeachesTech
@TonyTeachesTech 2 года назад
Yeah
@DroidRaxx
@DroidRaxx 3 года назад
Hello, What about the database backup?
@TonyTeachesTech
@TonyTeachesTech 3 года назад
You can look here ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-_zu9ss2RX-0.html
@chrisxu6491
@chrisxu6491 Год назад
What to do when tar-ing files that are owned by root? I got many "permission denied".
@shallex5744
@shallex5744 Год назад
use root permission when tarring them
@jeytis72
@jeytis72 Год назад
"Execute the daily backup script everyday at 12:15 AM" - What if I want to backup at 8:30 PM for example. Thanks
@shallex5744
@shallex5744 Год назад
then modify it accordingly
@KuroroLucifer21
@KuroroLucifer21 Год назад
Hi there, i am trying a whole week now to get rsnapshot running. Please, can u give an advice or recommendation for a tutorial for linux beginners? We are running ubuntu server, no problem with creating samba servers or webserver that serves us well, but until now - and after a dozen very different tutorials online (and everyone got so much differences) - we are just a few days before fucking the whole linux story and running everything with windows until ransomeware take us out. Before you recommend us to count the days until it happens and we deserve that - pleeeease reflect that out there, there are many small NGO's besides us (like aids help, abortion help, transexual help and other ngo's with just a few people who are really helpless and will shut down one after another in those days :( )
@keithmiller9665
@keithmiller9665 3 года назад
First of all thanks for video, very useful. It does however need editing as in several places you either make a mistake or get a bit lost. So it would definitely benefit from an hour or two of editing. Still a good video though. Thank You !
@TonyTeachesTech
@TonyTeachesTech 3 года назад
Sorry for that. I too make mistakes ;)
@mindtheyoutubegap
@mindtheyoutubegap 2 года назад
Andway to have the destination to be Google Drive?
@TonyTeachesTech
@TonyTeachesTech 2 года назад
No I don't think so
@laci272
@laci272 3 года назад
Tony, the contact form on your site is broken. "There was an error trying to send your message. Please try again later."
@TonyTeachesTech
@TonyTeachesTech 3 года назад
I'm not seeing this issue. What browser are you using?
@laci272
@laci272 3 года назад
@@TonyTeachesTech I've tried in Brave and Firefox and Opera:) (Opera is default, no plugins, no changes)
@TonyTeachesTech
@TonyTeachesTech 3 года назад
@@laci272 Thanks for letting me know. I'm not sure what's going on here. It's working for me on Chrome, Firefox, and Opera. Unfortunately there's no log file that I can check to debug. I changed the error message though to include my email address as an alternative method of contact. Please try again to see if that shows up for you and then feel free to contact me that way.
@laci272
@laci272 3 года назад
@@TonyTeachesTech i still get the old message:) There was an error trying to send your message. Please try again later. wait.. i'm on tonyteaches.tech .. are we talking about the same site?
@TonyTeachesTech
@TonyTeachesTech 3 года назад
@@laci272 I really apologize. I'm not sure what's going on here. Another way to get in contact with me directly is to get my email on my RU-vid about page ru-vid.com/show-UCWPJwoVXJhv0-ucr3pUs1dAabout
@surfreadjumpsleep
@surfreadjumpsleep 3 года назад
Should work on a mac also, correct?
@TonyTeachesTech
@TonyTeachesTech 3 года назад
Yeah. Only thing is a cron would require your mac to be on at the time it executes.
@alertshake8965
@alertshake8965 2 года назад
Borg is a better solution. Look for Borg backup.
Далее
Backup Strategies for Linux
32:24
Просмотров 11 тыс.
The Hardest Challenge!
00:37
Просмотров 12 млн
Linux Backup with TAR and Cron Jobs
35:33
Просмотров 249 тыс.
What Backup Software Should I Use?
10:12
Просмотров 8 тыс.
4 Linux Backup Utilities You Can Use
9:21
Просмотров 9 тыс.
Make an Incremental Backup Script with Bash!
16:25
Просмотров 11 тыс.
Rsync Backup on Linux
9:19
Просмотров 97 тыс.
Write Your Own Bash Scripts for Automation [Tutorial]
16:35
Cron Jobs For Beginners | Linux Task Scheduling
12:47
Просмотров 220 тыс.
60 Linux Commands you NEED to know (in 10 minutes)
10:50
Looks realistic #tiktok
0:22
Просмотров 52 млн