Browse Source
Merge pull request #136 from iloveitaly/fix-mysql
Fix mysql backup
pull/118/merge
Michael Bianco
3 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with
6 additions and
14 deletions
-
mysql-backup-s3/backup.sh
-
mysql-backup-s3/install.sh
-
mysql-backup-s3/run.sh
|
@ -1,4 +1,4 @@ |
|
|
#! /bin/sh |
|
|
|
|
|
|
|
|
#!/bin/sh |
|
|
|
|
|
|
|
|
set -e |
|
|
set -e |
|
|
|
|
|
|
|
|
|
@ -1,25 +1,16 @@ |
|
|
#! /bin/sh |
|
|
|
|
|
|
|
|
#!/bin/sh |
|
|
|
|
|
|
|
|
# exit if a command fails |
|
|
# exit if a command fails |
|
|
set -e |
|
|
set -e |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
apk update |
|
|
apk update |
|
|
|
|
|
|
|
|
# install mysqldump |
|
|
# install mysqldump |
|
|
apk add mysql-client |
|
|
apk add mysql-client |
|
|
|
|
|
|
|
|
# install s3 tools |
|
|
# install s3 tools |
|
|
apk add python py-pip |
|
|
|
|
|
|
|
|
apk add python3 py3-pip |
|
|
pip install awscli |
|
|
pip install awscli |
|
|
apk del py-pip |
|
|
|
|
|
|
|
|
|
|
|
# install go-cron |
|
|
|
|
|
apk add curl |
|
|
|
|
|
curl -L --insecure https://github.com/odise/go-cron/releases/download/v0.0.6/go-cron-linux.gz | zcat > /usr/local/bin/go-cron |
|
|
|
|
|
chmod u+x /usr/local/bin/go-cron |
|
|
|
|
|
apk del curl |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# cleanup |
|
|
# cleanup |
|
|
rm -rf /var/cache/apk/* |
|
|
rm -rf /var/cache/apk/* |
|
@ -1,4 +1,4 @@ |
|
|
#! /bin/sh |
|
|
|
|
|
|
|
|
#!/bin/sh |
|
|
|
|
|
|
|
|
set -e |
|
|
set -e |
|
|
|
|
|
|
|
@ -9,5 +9,6 @@ fi |
|
|
if [ "${SCHEDULE}" = "**None**" ]; then |
|
|
if [ "${SCHEDULE}" = "**None**" ]; then |
|
|
sh backup.sh |
|
|
sh backup.sh |
|
|
else |
|
|
else |
|
|
exec go-cron "$SCHEDULE" /bin/sh backup.sh |
|
|
|
|
|
|
|
|
echo "$SCHEDULE /bin/sh /backup.sh" > /etc/crontabs/root |
|
|
|
|
|
exec crond -d 8 -f |
|
|
fi |
|
|
fi |