문서의 선택한 두 판 사이의 차이를 보여줍니다.
| 양쪽 이전 판 이전 판 다음 판 | 이전 판 | ||
|
git:as_backup [2020/09/06 19:11] kwon37xi |
git:as_backup [2025/07/18 11:59] (현재) kwon37xi |
||
|---|---|---|---|
| 줄 1: | 줄 1: | ||
| ====== git as backup ====== | ====== git as backup ====== | ||
| * [[: | * [[: | ||
| + | * [[git: | ||
| + | * [[git: | ||
| ===== 특정 디렉토리 이하를 Git Repository로 백업할 때 ===== | ===== 특정 디렉토리 이하를 Git Repository로 백업할 때 ===== | ||
| 줄 27: | 줄 29: | ||
| </ | </ | ||
| - | ==== 주기적 백업을 수행할 shell script 생성 ==== | + | ===== 주기적 백업을 수행할 shell script 생성 |
| * '' | * '' | ||
| <code sh> | <code sh> | ||
| NOWT=$(date +" | NOWT=$(date +" | ||
| + | cd / | ||
| git add . | git add . | ||
| git commit -m "$NOWT Automated git push" | git commit -m "$NOWT Automated git push" | ||
| git push | git push | ||
| </ | </ | ||
| + | * commit 할게 없어도 오류 없이 무시된다. | ||
| - | ==== cron 등록 ==== | + | ===== cron 등록 ===== |
| + | * 매일 새벽 4시 5분에 실행. | ||
| <code sh> | <code sh> | ||
| - | */15 * * * * cd ~/path/to/dir && ./ | + | 5 4 * * * /path/to/backup.sh > / |
| </ | </ | ||
| - | * 로그를 계속 남기려면 로그 파일 리다이렉트를 ''>>'' | + | * 로그를 계속 남기려면 로그 파일 리다이렉트를 '' |
| ===== 참조 ===== | ===== 참조 ===== | ||
| * [[https:// | * [[https:// | ||