Last active
April 21, 2018 16:46
-
-
Save ngstigator/81ec7c2e6a8af64eda094d652124260a to your computer and use it in GitHub Desktop.
bash script create db subdir and backup to it
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# create {year} folder if it doesn't exist | |
mkdir -p /home/web/db/$(date +%Y) | |
# dump database into {year} folder | |
mysqldump --opt -uweb -pPASSWORD DATABASE_NAME | gzip > /home/web/db/$(date +%Y)/DATABASE_NAME_$(date +%Y%m%d-%H%M).sql.gz |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment