[asterisk-users] conf checkout
Danny Nicholas
danny at debsinc.com
Tue Sep 14 14:28:10 CDT 2010
Hi gang,
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.
File 1 - /usr/bin/checkout
/usr/local/bin/perl /etc/asterisk/checkout.pl $1
File 2 - /etc/asterisk/checkout.pl
#!/usr/local/bin/perl
# Author: Danny Nicholas
use File::Copy;
# assign command line parms
my $inname = $ARGV[0];
my ($sec, $min, $hr, $day, $mon, $year) = localtime(time);
$mon = $mon +1;
$mon = sprintf("%2d",$mon);
$day = sprintf("%2d",$day);
$hr = sprintf("%2d",$hr);
$min = sprintf("%2d",$min);
$mon =~ s/\s/0/;
$day =~ s/\s/0/;
$hr =~ s/\s/0/;
$min =~ s/\s/0/;
my $outname = $inname."_".$mon.$day."_".$hr.$min;
print "copy $inname to $outname\n";
copy($inname,$outname);
exit
If you are going to make a dialplan change, just do
Checkout /etc/asterisk/extensions.conf and voila, you have a backup to fall
back on.
Hope this helps somebody.
Regards,
Danny Nicholas
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.digium.com/pipermail/asterisk-users/attachments/20100914/6b9b053e/attachment.htm
More information about the asterisk-users
mailing list