[asterisk-users] conf checkout

Shaun Ruffell sruffell at digium.com
Tue Sep 14 15:33:29 CDT 2010


On 09/14/2010 02:51 PM, Steve Edwards wrote:
> On Tue, 14 Sep 2010, Danny Nicholas wrote:
> 
>> I see that some posters today don’t do full (or any?) backups of their
>> Asterisk systems/configuration.  This may (sort of) help you.  Since
>> pretty much all Linux systems have some sort of PERL installed, these
>> two files will let you make a quick copy of any configuration or other
>> file you might be about to change or destroy.
> 
> Good advice, however I prefer to work on a copy. I do something similar
> with a bash function:
> 
> # save a file creating a copy and appending a timestamp to the file name
>         function                        save()
>                 {
>                 SUFFIX=$(date +%Y-%m-%d-%H-%M-%S)
>                 mv $1 $1-${SUFFIX}
>                 cp $1-${SUFFIX} $1
>                 }
> 
> I do the move before the copy so I can undo my mistakes just by mv'ing
> the file with the suffix back to the file name without the suffix. That
> way, even the modification* date of the file is not changed and it won't
> be backed up unnecessarily.
> 
> If whatever I screwed up isn't discovered for a few days, I can choose
> which suffixed file I want to "restore."
> 
> Better advice would be to get off your LFA and do the backups :)
> 
> For all the hosts I manage, I have a script started by crontab that
> creates a tarball of the configuration and source files and emails the
> tarball back to me. I have a rule in my procmailrc to automagically dump
> the tarball into my /backup/ directory.
> 
> This shows its value when a client says "I like it better the way it was
> before Xmas" or "Why did you charge me $XXX 6 weeks ago Tuesday."
> 
> *) I'll leave it as an exercise for the reader to preserve the access
> and change dates :)
> 

While backups are always encouraged...'git' is very useful for this sort
of thing as well.  Even in conjunction with simple backups.  If you have
git installed...just:

#] cd /etc/asterisk
#] git init
#] git add .
#] git commit -m "initial import"

then anytime you make a change:

#] git commit -a -m "I changed xxx because of yyy"

Then you have a complete history of your changes for that directory.  No
need to setup a server.  Even if you only take single backups to a
remote machine...you still have all your changes in time (in case you
don't have a rotating backup schedule, etc..).  All the version control
information in this case would be stored in /etc/asterisk/.git
directory, so if you backup the /etc/asterisk folder...you have all your
version control history too.  It's also nice to "git ls-files -m" to see
what clients have been editing and what changes they made.

-- 
Shaun Ruffell
Digium, Inc. | Linux Kernel Developer
445 Jan Davis Drive NW - Huntsville, AL 35806 - USA
Check us out at: www.digium.com & www.asterisk.org



More information about the asterisk-users mailing list