#!/bin/sh msgpfx="Asterisk backup data: " tmstmp=`date "+%y%m%d%H%M%S"` bckdest=/var/backups/asterisk # =========================================================================== # process command line arguments # =========================================================================== # show version, copyright and license if [ "$1" == "--version" -o "$1" == "-v" ]; then echo "astbackup.sh version 1.00" echo "Copyright (C) 2006" echo "Released under the GNU General Public License (GPL)" exit 0 fi # if user requested online help, show usage if [ "$1" == "help" -o "$1" == "-h" ]; then echo "astbackup.sh" echo "" echo "archive Asterisk's configuration Files" echo "" echo "Usage:" echo " ./astbackup.sh [(--version | -v) | (help | -h)]" echo "" echo "The following directories will be archived in /var/backups/asterisk:" echo " /etc/asterisk into archive astbackup_YYMMDDhhmmss.tgz" echo "where YYMMDDhhmmss is a date-time stamp showing the time the script was run." echo "" echo "If the version option is specified, version, copyright and license is shown." exit 0 fi # create backup directory if it doesn't already exist if [ ! -d $bckdest ]; then mkdir $bckdest fi # =========================================================================== # archive asterisk config directory /etc/asterisk if it exists # =========================================================================== if [ -d /etc/asterisk ]; then conftarname=$bckdest/astbackup_$tmstmp.tgz echo $msgpfx "archiving /etc/asterisk ..." tar cvz -C /etc/asterisk -f $conftarname . fi # =========================================================================== # OK, we're done # =========================================================================== echo $msgpfx "done." # END OF FILE