how to generate Automated daily email backup of Multics configuration?
I would like to share with you some tips on how I successfully manage to backup my MultiCS configuration and receive regular daily email backups of my configuration.
I find that a general rule to follow is always "BETTER BE SAFE THAN SORRY"... loss of data can happen without warning, so it is a good practice to ALWAYS have a back up of important files for safety!
This guide will cover the following subjects:
- PREREQUISITES
- BACKUP OF ONE SINGLE MULTICS.CFG FILE
- BACKUP OF A FOLDER CONTAINING MULTIPLE FILES
- run "apt-get update" followed by "apt-get upgrade -y" on shell
- Ubuntu server (any version) with Postfix properly installed and configured (please see this guide if needed, skip configuration of additional email addresses)
- biabam package installed, using the command "apt-get install biabam -y" (thanks to my friend Ktzelepi for introducing me to this lovely package through his posts!)
BACKUP OF A SINGLE MULTICS.CFG FILE:
Let's assume that we want to receive a copy of our multics.cfg file sent to our email address every SIX HOURS (so, FOUR TIMES A DAY).
To do this, we need to create a cron job on our server which will take care of this for us. Let's do it!
On shell, we first make sure that the nano editor is the standard editor for editing crontab, using this command:
Save by using the CTRL+X key combination followed by "Y" for yes.
Then, we ask our server to edit the list of cronjobs automated tasks (crontab) like this:
Ensure crontab replies by saying:
That's it! You will now receive automated email backups of your multics.cfg file!!!
BACKUP OF A FOLDER CONTAINING MULTIPLE FILES (such as /var/etc)
This set up is extremely useful if you have (like me) individual cfg files (such as cccam.cfg, newcamd.cfg, etc) in the configuration directory of MultiCS to keep things much tidier.
We will make the backup and send it by email in two main steps: first we are going to compress the folder we need to backup into one single file (a .tar.gz file, which programs like "WinRar" and the likes can easily manage and extract.
We start by creating an extra folder on the server which will contain our compressed file, which will then be finally emailed to us by biabam, like this:
PLEASE NOTE: the script included DOES NOTE include in the backup the "ip2country.csv", for two main reasons: it's a big file that only changes once a month (so it doesn't make sense to back it up daily and also because you can download the most recent copy right here on the forum if you click here).
It will skip the file, as long as it is called "ip2country.csv", CASE SENSITIVE!
We now need to create a simple text file which contains the body of the email that we will receive. For simplicity, we are going to call it "message.txt" and we will place it in the /root directory. We do it with this command:
Save by using the CTRL+X key combination followed by "Y" for yes.
Now, we need to create TWO lines in our crontab, so we edit it like this:
Here is how we do it:
Then, we add the second line to crontab to actually email us the multics.tar.gz file EVERY SIX HOURS:
And, finally, for just once a day, like this:
Ensure crontab replies by saying:
That's it! You will now receive automated email backups of your entire configuration directory!!!
If you have any questions, please feel free to comment below (rather than PM me), so the entire forum community will benefit from your questions and the answers.
No comments: