I am working on a script to back up certain files and folders on a weekly or biweekly schedule. I know you can make a copy of the SD card but how many of us actually do that all the time?
so far I am backing up the asterisk folder as well as the Allmon, supermon, my private sounds folders, and the crontab file. What else should I back up?
I am not running ASL3 running the last version before 3.
BTW the script does the backup to a USB drive that stays connected to the pi at all times, always keeps the latest 2 backups and it saves a copy of the scripts with an additional script in case I need to restore or in case of a SD card failure it will copy back to the Pi the scripts and set their permissions and also make a cron job to run every Friday at 12:30 AM.
Still testing as it was a major pain getting the USB drive to mount automatically but I have figured that out I HOPE lol
Do you have a place where you put all your scripts not in existing paths ?
If you use dvswitch then that also may be a consideration /opt
You might not to go this far but menu/scripts also in /usr/bin/asl*
As unorthodox as it is, I normally put everything ‘I create’ and use for asterisk in
sub-directories of /etc/asterisk/ like scripts and sound files just to keep it close.
Back in the msdos days, that is how we did it till search path created issues.
Whatever your method, use it as a rule so even you know where everything is.
The skinny is you just need editable configs and self created content.
Scripts are in the /usr/local/bin folder so they are in the path. dvswitch I never liked after I used it once because it uses way too much data so I never configured it again.
Never thought about creating a subfolder in /etc/asterisk it will be a lot easier to backup all in one place.
And yes I also created a config so I can add any other path I need for any other folder or files. I just hate the setup every time I set up a new Pi so this started as a way to simplify things that started as a backup to FTP but a lot of people don’t have access to an FTP so the best alternative was backing up to an external source. For some reason, I get approached a lot asking for help with setting up nodes and then they think I am their private IT guy so I also wanted to make my life easier by making a backup and if they tinker and screw it up all I have to do is restore the last backup via SSH and saves me a lot of time.
I haven’t had a SD failure YET but it is a matter of time and with all the modifications I have done on the supermon, Allmon, sound files, and scripts I just wanted to be able to save it all and make it easy to go back to normal once a new SD was needed.
I might add…
A list of things you installed on the server ie
sox, lame, mpg123, midnightcommander and lots of other things we add over time for whatever toys we build.
It’s just nice to know if you are doing a restore and suddenly your scripts are not working because of some utility you forgot to install.
I have a long list, but hard to forget when I have it in a text file.
Something to thing on anyway. Most will not till they have an issue and realize what they lost and forgot how they did some things.
I became super redundant after a data loss of dos code I had spent over 1000 hours working on, but I kept notes and it was not half the time to remake.
I was making backups, but the software was in error and I was not verifying the backups to a tape drive which doubles the already long time to do it…
Now I use a redundant drive array on my lan since 2008. Best thing since sliced bread.
Share my files between devices anywhere anytime with only one copy to track.
Funny how when you have everything covered nothing goes wrong but as soon as you don’t, it all goes wrong…LOL
I copied the following as text files to my windows machine and then used copy and paste when I had to do a rebuild NOTE my node is headless you may need a few more
If you use SUPERMON… the "Configuration Editor button… copy everything listed
And in addition these will have to be copied
and any special files you have added
A note on bash-rc local
This is what I have in it. A list of alias commands making SSH editing of configuration files way way easier
alias iax=‘nano /etc/asterisk/iax.conf’
alias extensions=‘nano /etc/asterisk/extensions.conf’
alias allmon=‘nano /srv/http/supermon/allmon.ini’
alias global=‘nano /srv/http/supermon/global.inc’
alias manager=‘nano /etc/asterisk/manager.conf’
alias rpt=‘nano /etc/asterisk/rpt.conf’
alias d=‘ls -la’
alias restart=‘astres.sh’
The problem with your method that i encountered myself was that most text files are saved with windows line ends and when you put them back into the Pi they will not work because linux uses a different kind of line endings.
In the script that i made i included dos2unix i think is the neme and it verifies if the files copied back into the Pi have the unix line endings and change them if needed.
Nothing more frustrating than trying to run a script and getting an error for something you can’t see and don’t figure it out until you have changed half the code to try to make it work.
@Mike
I have added a few of things fir the script to install silently because I have been on that boat having something that worked great before and now in a new image it doesn’t just because I forgot that on the last image i installed something that the new image doesn’t have.
I have to make a list of all that i installed and the reason for the install so i can make the necessary adjustments.
It would be nice to see that list you have of programs you have used i might need some of them lol
Im VERY new to linux AND ASL3. I have a ASL3 node and want to backup the entire sdcard that it resides on. Can someone tell me how to backup the entire sdcard onto either another sdcard or even a memory stick. I want to be sure that I have EVERYTHING if I have to restore a backup. What software would I use? Any help would be greatly appreciated.
Dave
N8EPF
@dbeaujean
I made this script for the older version of Allstar but if you want to try it on ASL3 ill give you access to it so you can try it.
That way you can serve as a beta tester for ASL3 and i will modify it to work with it.
I am not running any of my nodes on ASL3 so i will have to modify the script as i am sure some of the files or folders have either changed name or location.
Thanks for the offer. But I would not be a good beta tester. Im just learning linux and have a hard time as it is. I would be interested in your script once its been trough the ringer though.
Dave
N8EPF
Well I put them back the same way I made them. Copy and paste.
To make them I copied from Supermon’s configuration editor… I could have copied from NANO via SSH.
To restore. I copied the text file. and pasted (right click) to NANO.after deleting the default text from the Nano screen… All I can tell you is everything works just as it did before including the one node I can’t seem to connect to (and no I’m not blacklisted)
It’s a timing issue with my ISP.
For my local stuff, I use BalenaEtcher, and clone the SD card to my NAS. You can then just write the image back to the existing card or a new one. Quick process in both directions.