[asterisk-users] conf checkout
Steve Edwards
asterisk.org at sedwards.com
Tue Sep 14 14:51:34 CDT 2010
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 :)
--
Thanks in advance,
-------------------------------------------------------------------------
Steve Edwards sedwards at sedwards.com Voice: +1-760-468-3867 PST
Newline Fax: +1-760-731-3000
More information about the asterisk-users
mailing list