Skip to content

Asterisk Server Backup conf Files to FTP

by Jon on January 8th, 2010

Recently I needed to backup conf files from many asterisk servers so I decided to make a script that would backup all the files and upload to an ftp server for archiving. This is a simple script that just requires an ftp server and a script to be put into the cron.daily folder. Below is the script, there are 3 things that have to be changed for it to work, the ftp server address, ftp username and the ftp password.

#!/bin/bash
SERVERNAME=”asteriskserver-”
TODAYFILE=$SERVERNAME$(date +%Y%m%d).tar.gz
TODAYFOLDER=$SERVERNAME$(date +%Y%m%d)
echo $TODAYFILE
echo $TODAYFOLDER
mkdir /tmp/$TODAYFOLDER
cp -R /etc/asterisk/ /tmp/$TODAYFOLDER/
cd /tmp
tar -czf $TODAYFILE $TODAYFOLDER
ftp -n -v ftp.serverurl.com << EOT
user ftpusername ftppassword
prompt
put $TODAYFILE $TODAYFILE
bye
EOT
sleep 5

From → Linux

No comments yet

Leave a Reply

Note: XHTML is allowed. Your email address will never be published.

Subscribe to this comment feed via RSS

%d bloggers like this: