#!/bin/bash
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
export PATH
s_date=`date '+%Y-%m-%d %H:%M:%S'`;
HEADER="Backup data"
BACKUPDIR="/var/lib/mysql /home/adj"
back_www_dir="/backup/www_data"
echo ${s_date};
#
# 開始備份
#
week_num=$(date +%w);
cd $back_www_dir
for TARGET in $BACKUPDIR
do
base_name=`basename $TARGET`
if [ "$base_name" != "" ]; then
$(tar -jcvPf ${base_name}-${week_num}.tar.bz2 ${TARGET}) > /dev/null 2>&1;
sleep 1;
fi
done
e_date=`date '+%Y-%m-%d %H:%M:%S'`;
echo $e_date;
echo "-------------------------";
exit;
############ Backup Weekend ####################
0 5 * * * /etc/backup_7Days >> /backup/www_data/backup.log
歡迎光臨 ADJ網路實驗室 (http://dz.adj.idv.tw/) | Powered by Discuz! 6.0.0 |