리눅스 백업 스크립트리눅스 백업 스크립트

Posted at 2010. 10. 5. 13:13 | Posted in Server
반응형

#!/bin/sh 
#mysql db 
/usr/local/mysql/bin/mysqldump -uID -pPASS --all-database > /backup/DB/db_all_$(date +%Y%m%d).sql 
/usr/local/mysql/bin/mysqldump -uID -pPASS  DB명 > /backup/DB/koreafrom_$(date +%Y%m%d).sql 
/usr/local/mysql/bin/mysqldump -uID -pPASS  DB명 > /backup/DB/bjms_$(date +%Y%m%d).sql 
/usr/local/mysql/bin/mysqldump -uID -pPASS  DB명 > /backup/DB/dbkoreafrom_$(date +%Y%m%d).sql 
/usr/local/mysql/bin/mysqldump -uID -pPASS  DB명> /backup/DB/bjms_$(date +%Y%m%d).sql

 


#html 
tar cvfpz /backup/HTML/HTML_ALL_$(date +%Y%m%d).tar.gz /BACKUP할 폴더명
tar cvfpz /backup/HTML/HTML_KOREAFROM_$(date +%Y%m%d).tar.gz /BACKUP할 폴더명 
tar cvfpz /backup/HTML/HTML_BJMS_$(date +%Y%m%d).tar.gz /BACKUP할 폴더명 
tar cvfpz /backup/HTML/HTML_ITDI_$(date +%Y%m%d).tar.gz /BACKUP할 폴더명


#delete 
find /backup/DB/* -ctime +3 -exec rm -f {} \; 
find /backup/HTML/* -ctime +3 -exec rm -f {} \;

반응형

//