Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ubuntu 20.04 요나 자동 백업 #40

Open
doortts opened this issue Mar 2, 2021 · 0 comments
Open

ubuntu 20.04 요나 자동 백업 #40

doortts opened this issue Mar 2, 2021 · 0 comments

Comments

@doortts
Copy link

doortts commented Mar 2, 2021

@joonshin79 (Yoonsik Shin) 님이 작성한 게시글입니다.
---

아래 작성후 crontab 등록

#!/bin/bash

sourcePath=/var/www/
backupPath=/var/www/backup/
backupDate=$(date +%Y%m%d)

USERNAME=yona
PASSWORD=DB패스워드
DATABASE=yona

cd $sourcePath
tar -zcvf $backupDate'_'$DATABASE.tar.gz html
mv $backupDate'_'$DATABASE.tar.gz $backupPath
cd $backupPath

mysqldump -u$USERNAME -p$PASSWORD $DATABASE > $backupPath/$backupDate'_'$DATABASE.sql

# 5일까지만 보관 이전 파일들 삭제
find $backupPath* -mtime +5 -name "*backupDate*" -exec rm {} \;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant