自己写的备份服务器的脚本

发表于:2007-07-04来源:作者:点击数: 标签:
自己写的备份 服务器 的脚本 #!/bin/bash # back system config and httpd log DATENOW=(date +%Y-%m-%d) cd / tar cfz /var/www/web/admin/etc.tgz etc cd /var/www/web/admin mysqldump -Q --password=jerryvim --opt -B aiqing avo geofuture leidi17 lizi
自己写的备份服务器的脚本

#!/bin/bash

# back system config and httpd log
DATENOW=$(date +%Y-%m-%d)
cd /
tar cfz /var/www/web/admin/etc.tgz etc
cd /var/www/web/admin
mysqldump -Q --password=jerryvim --opt -B aiqing avo geofuture leidi17 lizi17 phpmyadmin qiti swy 新COM > $DATENOW-dbdump
mysqldump -Q --password=jerryvim --opt -B fiveone > $DATENOW-fiveonedump
mysqldump -Q --password=jerryvim --opt -B newcom > $DATENOW-newcomdump
mysqldump -Q --password=jerryvim --opt -B newnet > $DATENOW-newnetdump
mysqldump -Q --password=jerryvim --opt -B mysql > $DATENOW-mysqldump

cd /var/www/web/
tar cvfzp /home/jerry/5117net.tgz 5117net
tar cvfzp /home/jerry/sites.tgz sites
tar cvfzp /home/jerry/5117com.tgz 5117com --exclude=5117com/ni --exclude=5117com/data
tar cvfzp /home/jerry/data_nofile.tgz 5117com/data --exclude=5117com/data/file
tar cvfzp /home/jerry/ni_nosoft.tgz 5117com/ni --exclude=5117com/ni/admin/softdownload
tar cvfzp /home/jerry/data_file.tgz 5117com/data/file
tar cvfzp /home/jerry/ni_soft.tgz 5117com/ni/admin/softdownload

# backs up all files in current directory modified within last 24 hours in a tarball
cd /var/www/web/
ls -lfR > /home/jerry/file_list-$DATENOW
find . -mtime -1 -type f -print0 | xargs -0 -r tar cvfzp /home/jerry/web-$DATENOW
ls -l /home/jerry/*.tgz > /home/jerry/ls-$DATENOW

原文转自:http://www.ltesting.net