歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
您现在的位置: Linux教程網 >> UnixLinux >  >> Unix知識 >> 關於Unix

自己寫的備份服務器的腳本

自己寫的備份 服務器 的腳本 #!/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

Copyright © Linux教程網 All Rights Reserved