King Computer Solutions

Script to backup Asterisk folders

The key folders to backup for asterisk are

You can use this script to back them up into one gz file.

ora=`date ‘+%Y.%m.%d-%H.%M.%S’`
tar zcf etc-asterisk-$ora.tar.gz /etc/asterisk
tar zcf var-log-asterisk-$ora.tar.gz /var/log/asterisk
tar zcf var-lib-asterisk-$ora.tar.gz /var/lib/asterisk
tar zcf var-spool-asterisk-$ora.tar.gz /var/spool/asterisk
tar zcf usr-lib-asterisk-$ora.tar.gz /usr/lib/asterisk
tar zcf var-lib-mysql-$ora.tar.gz /var/lib/mysql
tar zcf usr-local-tomcat-$ora.tar.gz /usr/local/tomcat/webapps
# make one big file of them all
tar zcf asterisk-backup-$ora.tgz *$ora*
rm -f $ora.tar.gz

Also found this article on backup and restore