Aggam Rahamim's Site

Home Contact Random RSS

📅 02-04-2021 👀 84

non-system backups on linux

I didn’t do backups

I didn’t do backups. I figured it’s not worth the hassle of manualy keeping backups, or the money for storage space on the cloud/another storage medium on my PC. I got stuff deleted before. Back when I used windows (~5 months ago, not that long), I had ransomware delete my ENTIRE PC. Even the, nothing important got deleted, since I just happened to have a backup of my projects on a flash drive.

Why now?

So, about a week ago, I was working on a shell script that was supposed to be a file manager that would run in the terminal. It was realy basic, but it worked! I’ve not made the menu sysetm byself, but I had made a lot of progress. At some point, I added “delete”, so you can delete files. You can probably guess what happend next - I had accidently delete THE WHOLE THING! and while I have backups for my system using timeshift (great program btw), I don’t backup my home directory, becuase then if I roll back, I would lose a day or even more of documents, pictures and projects.


I’ve decided to backup only the projects/ directory in my home directory. At this point I also knew basic shell scripting becuase I was working on the file manager. I made a script that will read from a file, located in ~/backups/foldersToBackup, and copy every directory stated in that file, to ~/backups/folders<CURRENT-DATE>. For sceduling, I used crontab, which is AMAZING! after editing the crontab file using crontab -e, and adding 0 1 * * * /home/aggam/backups/ to it, the script ran on a daily basis on 1:00 AM. The script is available here on github.

This is my first article! I hope it was good! I am probably gonna add contact me in a few hours or so you can give me suggestions! I’m also new to this whole web-deving server-hosting thing.