1, back up the usual footsteps:
Footsteps One
#!/bin/shmkdir-p/backup/' date +%y%m%d ' cd/opt/tar-czvf/backup/' date +%y%m%d '/m_ ' date +%s '. tar.gz m/
Script two:
#! /bin/bashmkdir-p/backup/' date +%y%m%d ' cd/opt/tar-czvf/backup/' date +%y%m%d '/m_ ' date +%y%m%d%h%m%s '. tar.gz-- Exclude=files--exclude=*.jar m/tar-czvf/backup/' date +%y%m%d '/home_ ' date +%y%m%d%h%m%s '. tar.gz--exclude=files-- Exclude=*.jar home/
Script Three:
#! /bin/bashmkdir-p/backup/webapp/' Date +%y%m%d ' cd/gjbweb/#tar-czvf/backup/' date +%y%m%d '/webapp_ ' date +%Y%m%d%H%M%S '. tar.gz--exclude=files--exclude=*.jar webapp/tar-czvf/backup/webapp/' date +%y%m%d '/webapp_ ' Date +%Y%m%d%H%M%S '. tar.gz--exclude=files--exclude=appfiles--exclude=zipfstmp* webapp/
2, commonly used compression script:
#! /bin/bashcd/gjbweb/tomcat/logsfind/gjbweb/tomcat/logs-type f-mtime +2|grep-v "tar.gz" |grep-v "archive.sh" |while rea D linedolname= ' basename $line ' tar-czvf $lname ". tar.gz" $lname--remove-filesdone
#! /bin/bashcd/guojinbao/backup/logsfind/guojinbao/backup/logs-type f|grep-v "tar.gz" |grep-v "archive.sh" |while read Linedolname= ' basename $line ' tar-czvf $lname ". tar.gz" $lname--remove-filesdone
This article from "Breght Moon" blog, declined reprint!
Auto-packaged backup compression common footsteps