diff --git a/README.md b/README.md index ffe8fe0..59871af 100644 --- a/README.md +++ b/README.md @@ -21,9 +21,10 @@ redis:backup (--use-iam) Create a backup of the redis service to redis:backup-auth () () () Sets up authentication for backups on the redis service redis:backup-deauth Removes backup authentication for the redis service redis:backup-schedule Schedules a backup of the redis service -redis:backup-set-encryption , Sets up GPG encryption for future backups of the redis service +redis:backup-schedule-cat Cat the contents of the configured backup cronfile for the service +redis:backup-set-encryption Sets up GPG encryption for future backups of the redis service redis:backup-unschedule Unschedules the backup of the redis service -redis:backup-unset-encryption , Removes backup encryption for future backups of the redis service +redis:backup-unset-encryption Removes backup encryption for future backups of the redis service redis:clone Create container then copy data from into redis:connect Connect via redis-cli to a redis service redis:create Create a redis service with environment variables @@ -205,6 +206,9 @@ dokku redis:backup lolipop BUCKET_NAME # CRON_SCHEDULE is a crontab expression, eg. "0 3 * * *" for each day at 3am dokku redis:backup-schedule lolipop CRON_SCHEDULE BUCKET_NAME +# cat the contents of the configured backup cronfile for the service +dokku redis:backup-schedule-cat lolipop + # remove the scheduled backup from cron dokku redis:backup-unschedule lolipop ``` diff --git a/common-functions b/common-functions index 7450339..5e79fb4 100755 --- a/common-functions +++ b/common-functions @@ -196,6 +196,18 @@ service_backup_schedule() { 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() { declare desc="unschedules the backup of the service" declare SERVICE="$1" diff --git a/subcommands/backup-schedule-cat b/subcommands/backup-schedule-cat new file mode 100755 index 0000000..3cfd326 --- /dev/null +++ b/subcommands/backup-schedule-cat @@ -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 "$@"