首页 > 代码库 > 备份脚本

备份脚本

#!/bin/bash

clear  

echo ""

echo "*******************************************************************************************"

echo "****************************Welcome using the Automated scripts****************************"

echo "*******************************************************************************************"
echo ""
echo "                                   ->1|backup *********                                    "
echo ""
echo "*******************************************************************************************"

echo ""

mcmbc_data=/data/www/8082
mcmbc_backup=/data/backup/tomcat/8082
today=`date +%Y%m%d%H%M`

#back mcmbc
backupCmbc () {
    cd ${mcmbc_data}
    tar czvf mcmbc-${today}.tar.gz mcmbc
    mv mcmbc-${today}.tar.gz ${mcmbc_backup}
}

if [ "$1" != "" ] ; then
    if [ $1 == 1 ] ; then
        backupCmbc
    else
    echo "选择有误,再见!~"
    fi
else
    read -p "Enter index number to select: " 

    if [ "${REPLY}" == 1 ] ; then
        backupCmbc
    else
        echo "选择有误,再见!"
  fi
fi

 

备份脚本