Last active
March 4, 2019 06:12
-
-
Save ianthekid/4e6a43a656a90dd05a098796bf24084c to your computer and use it in GitHub Desktop.
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/sh | |
# BACKUP SCRIPT | |
# DATABASE | |
DBNAME="dbname" | |
DBUSER="dbuser" | |
DBPASS="dbpass" | |
# PATHS | |
DIRDB="/backup/db" | |
DIRBACKUP="/backup" | |
DIRFILES="/var/www/html" | |
# BACKUP DB AND FILES | |
mysqldump -u "$DBUSER" --password='"$DBPASS"' "$DBNAME" > "$DIRDB"/`date +%Y-%m-%d_%H-%M`.sql | |
tar --exclude=**/.git/* --exclude=**/node_modules/* -cf "$DIRBACKUP"/`date +%Y-%m-%d_%H-%M`.tar.gz -z -C "$DIRFILES" . |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment