서버구축,나스구축,서버관리,윈도우서버,리눅스서버,서버관리

Posted
Filed under 프로그래밍/MY-SQL

$vi back.sh

 

 

01
 
#!/bin/sh
 


02  


03 time=`date '+%Y%m%d%H%M'`


04 etc="etc"


05  


06 cd /


07 backup_path ="/backup_path/"


08 cd $backup_path


09  


10 mysqldump -u[userid] -p[userpwd] [dbname] > "$time.sql" --default-character-set=latin1 --set-charset 

 

11
 
find /backup_path/* -mtime +5 -exec rm -f {} ';
 

 


$chmod 700 back.sh

$crontab -e

00 05 * * * /path/backup.sh

(새벽 5시 정각)

 

* --default-character-set=latin1 --set-charset 캐릭터셋 지정

2015/02/27 14:12 2015/02/27 14:12