MultiCS Kurulum & install Automated daily email backup of Multics configuration.

Durum
Üzgünüz bu konu cevaplar için kapatılmıştır...

TüRKMaSTeR

Administrator
Yönetici
Katılım
16 Ocak 2020
Mesajlar
1,111
Tepkime puanı
15,843
Puanları
116
Ofline
Hello fellow MultiCS sharers!!!
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
PREREQUISITES:

  1. run "apt-get update" followed by "apt-get upgrade -y" on shell
  2. Ubuntu server (any version) with Postfix properly installed and configured ( , skip configuration of additional email addresses)
  3. 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:
export EDITOR=nano
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:

nano /root/message.txt
A blank file will appear. Type anything you wish in there, something like "my VPS server multics.cfg backup".
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:

We then add the instruction to have our server send the multics.cfg file in crontab like this:

0 */6* * * biabam /var/etc/multics.cfg -s SUBJECT OF EMAIL YOUR EMAIL ADDRESS GOES HERE < /root/message.txt
So, assuming that you have your multics.cfg file in /var/etc/, that you want the subject of the email to be "server_1_multics_conf_backup" and your email address to be something like myemail@mydomain.com, change the line like this:

0 */6* * * biabam /var/etc/multics.cfg -s server_1_multics_conf_backup myemail@mydomain.com < /root/message.txt
If you want to receive it every 12 hours, for instance, change it like this:
0 */12* * * biabam /var/etc/multics.cfg -s server_1_multics_conf_backup myemail@mydomain.com < /root/message.txt
And, finally, for just once a day, like this:
0 * * * * biabam /var/etc/multics.cfg -s server_1_multics_conf_backup myemail@mydomain.com < /root/message.txt
Don't forget to save by using the CTRL+X key combination followed by "Y" for yes.
Ensure crontab replies by saying:
crontab: installing new crontab
If it doesn't return this confirmation message, check that you haven't mistyped accidentally and try again.

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:
Then, we upload the "multicsbackup.sh" file contained in the zip I attach to this post to our server by SFTP and we place it in the / directory on the server (the very top one!).

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.




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:

nano /root/message.txt
A blank file will appear. Type anything you wish in there, something like "my VPS configuration folder backup".
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:

export EDITOR=nano
crontab-e
We add two lines here: the first one will run the script to compress the folder into one single multics.tar.gz file which will be placed in /backup, and the second one which will email the multics.tar.gz containing the folder itself compressed.

Here is how we do it:

0 * * * * /multicsbackup.sh > /dev/null 2>&1
This line will run the script and zip the folder on the server EVERY HOUR, always overwriting the copy each time.

Then, we add the second line to crontab to actually email us the multics.tar.gz file EVERY SIX HOURS:

0 */6* * * biabam /backup/multics.tar.gz -s SUBJECT OF EMAIL YOUR EMAIL ADDRESS GOES HERE < /root/message.txt
So, if you want the subject of the email to be "server_1_multics_confdir_backup" and your email address to be something like myemail@mydomain.com, change the line like this:

0 */6* * * biabam /backup/multics.tar.gz -s server_1_multics_confdir_backup myemail@mydomain.com < /root/message.txt
If you want to receive it every 12 hours, for instance, change it like this:
0 */12* * * biabam /backup/multics.tar.gz -s server_1_multics_confdir_backup myemail@mydomain.com < /root/message.txt

And, finally, for just once a day, like this:
0 * * * * biabam /backup/multics.tar.gz -s server_1_multics_confdir_backup myemail@mydomain.com < /root/message.txt
Don't forget to save by using the CTRL+X key combination followed by "Y" for yes.
Ensure crontab replies by saying:
crontab: installing new crontab
If it doesn't return this confirmation message, check that you haven't mistyped accidentally and try again.

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.

NOTE FOR THE MODERATORS: Feel free to pin this topic if you believe it may help your work!
 

Ekli dosyalar

  • multicsbackup.zip
    945 bayt · Görüntüleme: 26
Durum
Üzgünüz bu konu cevaplar için kapatılmıştır...
Üst