Permalink
Branch: master
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
executable file 38 lines (29 sloc) 1.1 KB
#!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
CRON_CMD="$PLUGIN_AVAILABLE_PATH/letsencrypt/cron-job"
CRON_JOB="@daily $CRON_CMD"
letsencrypt_cron_job_add () {
#shellcheck disable=SC2034
declare desc="Add auto-renew cronjob to dokku user's crontab"
((crontab -l || true) | (fgrep -v "$CRON_CMD" || true); echo "$CRON_JOB") | crontab -
dokku_log_info1 "Added cron job to dokku's crontab."
}
letsencrypt_cron_job_remove () {
#shellcheck disable=SC2034
declare desc="Remove auto-renew cronjob from dokku user's crontab"
(crontab -l || true) | (fgrep -v "$CRON_CMD" || true) | crontab -
dokku_log_info1 "Removed cron job from dokku's crontab."
}
letsencrypt_cron_job_cmd () {
#shellcheck disable=SC2034
declare desc="add or remove a cron job that periodically calls auto-renew"
if [[ $2 == "--add" ]]; then
letsencrypt_cron_job_add
elif [[ $2 == "--remove" ]]; then
letsencrypt_cron_job_remove
else
dokku_log_verbose "Use --add or --remove to add or remove the cron job."
fi
}
letsencrypt_cron_job_cmd "$@"