Compare commits

...

2 Commits
1.1.1 ... 1.2.0

Author SHA1 Message Date
Jose Diaz-Gonzalez
1d25c671bb Release 1.2.0 2018-04-23 14:39:27 -04:00
Jose Diaz-Gonzalez
77c64b4045 feat: create backup-schedule-cat subcommand 2018-04-23 14:39:26 -04:00
4 changed files with 39 additions and 3 deletions

View File

@@ -21,9 +21,10 @@ mysql:backup <name> <bucket> (--use-iam) Create a backup of the mysql service to
mysql:backup-auth <name> <aws_access_key_id> <aws_secret_access_key> (<aws_default_region>) (<aws_signature_version>) (<endpoint_url>) Sets up authentication for backups on the mysql service mysql:backup-auth <name> <aws_access_key_id> <aws_secret_access_key> (<aws_default_region>) (<aws_signature_version>) (<endpoint_url>) Sets up authentication for backups on the mysql service
mysql:backup-deauth <name> Removes backup authentication for the mysql service mysql:backup-deauth <name> Removes backup authentication for the mysql service
mysql:backup-schedule <name> <schedule> <bucket> Schedules a backup of the mysql service mysql:backup-schedule <name> <schedule> <bucket> Schedules a backup of the mysql service
mysql:backup-set-encryption <name> <encryption_key>, Sets up GPG encryption for future backups of the mysql service mysql:backup-schedule-cat <name> Cat the contents of the configured backup cronfile for the service
mysql:backup-set-encryption <name> <encryption_key> Sets up GPG encryption for future backups of the mysql service
mysql:backup-unschedule <name> Unschedules the backup of the mysql service mysql:backup-unschedule <name> Unschedules the backup of the mysql service
mysql:backup-unset-encryption <name>, Removes backup encryption for future backups of the mysql service mysql:backup-unset-encryption <name> Removes backup encryption for future backups of the mysql service
mysql:clone <name> <new-name> Create container <new-name> then copy data from <name> into <new-name> mysql:clone <name> <new-name> Create container <new-name> then copy data from <name> into <new-name>
mysql:connect <name> Connect via mysql to a mysql service mysql:connect <name> Connect via mysql to a mysql service
mysql:create <name> Create a mysql service with environment variables mysql:create <name> Create a mysql service with environment variables
@@ -217,6 +218,9 @@ dokku mysql:backup lolipop BUCKET_NAME
# CRON_SCHEDULE is a crontab expression, eg. "0 3 * * *" for each day at 3am # CRON_SCHEDULE is a crontab expression, eg. "0 3 * * *" for each day at 3am
dokku mysql:backup-schedule lolipop CRON_SCHEDULE BUCKET_NAME dokku mysql:backup-schedule lolipop CRON_SCHEDULE BUCKET_NAME
# cat the contents of the configured backup cronfile for the service
dokku mysql:backup-schedule-cat lolipop
# remove the scheduled backup from cron # remove the scheduled backup from cron
dokku mysql:backup-unschedule lolipop dokku mysql:backup-unschedule lolipop
``` ```

View File

@@ -196,6 +196,18 @@ service_backup_schedule() {
sudo /bin/chmod 644 "$CRON_FILE" sudo /bin/chmod 644 "$CRON_FILE"
} }
service_backup_schedule_cat() {
declare desc="cat the contents of the configured backup cronfile for the service"
declare SERVICE="$1"
local CRON_FILE="/etc/cron.d/dokku-${PLUGIN_COMMAND_PREFIX}-${SERVICE}"
if [[ ! -f "$CRON_FILE" ]]; then
dokku_log_fail "There is no scheduled backup for ${SERVICE}."
fi
cat "$CRON_FILE"
}
service_backup_unschedule() { service_backup_unschedule() {
declare desc="unschedules the backup of the service" declare desc="unschedules the backup of the service"
declare SERVICE="$1" declare SERVICE="$1"

View File

@@ -1,4 +1,4 @@
[plugin] [plugin]
description = "dokku mysql service plugin" description = "dokku mysql service plugin"
version = "1.1.1" version = "1.2.0"
[plugin.config] [plugin.config]

20
subcommands/backup-schedule-cat Executable file
View File

@@ -0,0 +1,20 @@
#!/usr/bin/env bash
source "$(dirname "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)")/config"
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
source "$PLUGIN_BASE_PATH/common/functions"
source "$(dirname "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)")/functions"
service-backup-schedule-cat-cmd() {
#E cat the contents of the configured backup cronfile for the service
#E dokku $PLUGIN_COMMAND_PREFIX:backup-schedule-cat lolipop
#A service, service to run command against
declare desc="cat the contents of the configured backup cronfile for the service"
local cmd="$PLUGIN_COMMAND_PREFIX:backup-schedule-cat" argv=("$@"); [[ ${argv[0]} == "$cmd" ]] && shift 1
declare SERVICE="$1"
[[ -z "$SERVICE" ]] && dokku_log_fail "Please specify a name for the service"
verify_service_name "$SERVICE"
service_backup_schedule_cat "$SERVICE"
}
service-backup-schedule-cat-cmd "$@"