제가쓰는 데이터 백업 스크립트
MySQL 데이터 디렉토리를 통째로 압축해서 격리보관하는 경우입니다.
아래에도 비슷한 내용이 있는데요..
저같은 경우에는 30일 지난 파일은 삭제하는 기능까지 해놓았네요.
db_backup.sh
---------------------------------------------------------------------
#/bin/sh
today=`date +%Y%m%d`
#Database backup
tar -cvzf /home/backup/db_backup_$today.tgz /usr/local/mysql/data/
#Old Data Delete
find /home/backup/ -atime 30 -print -exec rm -f {} \;
---------------------------------------------------------------------
-atime 30 요부분이 30일 지난 파일 찾는거에요..
댓글 1개
6년 전
man find 입니다.
-atime n
File was last accessed n*24 hours ago. When find figures out how many 24-hour periods ago the file was last accessed, any fractional part is ignored, so to match -atime +1, a file has to have been accessed at least two days ago.
-atime n
File was last accessed n*24 hours ago. When find figures out how many 24-hour periods ago the file was last accessed, any fractional part is ignored, so to match -atime +1, a file has to have been accessed at least two days ago.
게시판 목록
개발자팁
개발과 관련된 유용한 정보를 공유하세요.
질문은 QA에서 해주시기 바랍니다.
질문은 QA에서 해주시기 바랍니다.
| 번호 | 분류 | 제목 | 글쓴이 | 날짜 | 조회 |
|---|---|---|---|---|---|
| 5336 | 1년 전 | 960 | |||
| 5335 | 1년 전 | 980 | |||
| 5334 | 1년 전 | 893 | |||
| 5333 | 1년 전 | 723 | |||
| 5332 |
바다클라우드
|
1년 전 | 3649 | ||
| 5331 |
뽕엄능브라
|
1년 전 | 1675 | ||
| 5330 | 1년 전 | 1335 | |||
| 5329 |
|
1년 전 | 2658 | ||
| 5328 | 1년 전 | 2465 | |||
| 5327 | 1년 전 | 3653 | |||
| 5326 | 1년 전 | 1554 | |||
| 5325 | JavaScript |
|
1년 전 | 695 | |
| 5324 | OS | 1년 전 | 759 | ||
| 5323 | PHP |
|
1년 전 | 902 | |
| 5322 | PHP |
|
1년 전 | 802 | |
| 5321 | PHP |
|
1년 전 | 659 | |
| 5320 | PHP |
|
1년 전 | 761 | |
| 5319 | PHP |
techstar
|
1년 전 | 809 | |
| 5318 | JavaScript |
|
1년 전 | 676 | |
| 5317 | PHP |
|
1년 전 | 620 | |
| 5316 | PHP |
|
1년 전 | 582 | |
| 5315 | PHP |
|
1년 전 | 690 | |
| 5314 | PHP |
|
1년 전 | 669 | |
| 5313 | PHP |
techstar
|
1년 전 | 770 | |
| 5312 | 정규표현식 |
|
1년 전 | 646 | |
| 5311 | JavaScript |
|
1년 전 | 716 | |
| 5310 | PHP |
|
1년 전 | 2127 | |
| 5309 | PHP |
techstar
|
1년 전 | 1617 | |
| 5308 | PHP |
techstar
|
2년 전 | 680 | |
| 5307 | node.js |
swallow
|
2년 전 | 1434 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기