Skip to content

Instantly share code, notes, and snippets.

@void-elf
Created June 14, 2017 03:01
Show Gist options
  • Select an option

  • Save void-elf/afb8dd808dc1a522be914a21c910fd97 to your computer and use it in GitHub Desktop.

Select an option

Save void-elf/afb8dd808dc1a522be914a21c910fd97 to your computer and use it in GitHub Desktop.
mystery certbot-auto-cron RHEL diff
if [ "$configure_cron" -eq 1 -a -f /etc/debian_version ]; then
+ # when a normal user creates a crontab via `sudo`, it gets added to the root crontab
+ root_crontab_dir=/var/spool/cron/crontabs/root
ConfigureCronDeb
+ elif [ "$configure_cron" -eq 1 -a -f /etc/redhat-release ]; then
+ ConfigureCronDeb # will this work???
elif [ "$configure_cron" = 1 ]; then
echo "Generating cron jobs for your system is not supported yet."
echo "For instructions on doing this manually:"
- echo "https://certbot.eff.org/docs/using.html#renewing-certificates" # these instructions would freak a beginner out
+ echo "https://certbot.eff.org/docs/using.html#renewing-certificates" # TODO: link to better instructions
fi
else
@@ -382,7 +386,7 @@ else
# Each phase checks the version of only the thing it is responsible for
# upgrading. Phase 1 checks the version of the latest release of
# certbot-auto (which is always the same as that of the certbot
- # package). Phase 2 checks the version of the locally installed certbot.
+# package). Phase 2 checks the version of the locally installed certbot.
if [ ! -f "$VENV_BIN/letsencrypt" ]; then
if [ "$HELP" = 1 ]; then
diff --git a/letsencrypt-auto-source/pieces/bootstrappers/deb_common.sh b/letsencrypt-auto-source/pieces/bootstrappers/deb_common.sh
index 2e5dc0d..755d183 100644
--- a/letsencrypt-auto-source/pieces/bootstrappers/deb_common.sh
+++ b/letsencrypt-auto-source/pieces/bootstrappers/deb_common.sh
@@ -119,10 +119,7 @@ BootstrapDebCommon() {
}
ConfigureCronDeb() {
- if [ -z "$cron" ]; then
- # when a normal user creates a crontab via `sudo`, it gets added to the root crontab
- root_crontab_dir=/var/spool/cron/crontabs/root
-
+ if [ -z "$configure_cron" ]; then
if $SUDO test ! -f "$root_crontab_dir"; then
echo "Directory $root_crontab_dir doesn't exist. Creating."
else
@@ -137,6 +134,11 @@ ConfigureCronDeb() {
echo "$crontab_text" > $tmp_cron_file
$SUDO crontab $tmp_cron_file
rm $tmp_cron_file
+
+ if [ ! -z $configure_cron ]; then
+ $SUDO service crond start
+ fi
+
else
echo "Not adding a renewal cron job for certbot, as one already exists."
fi
diff --git a/letsencrypt-auto-source/pieces/bootstrappers/rpm_common.sh b/letsencrypt-auto-source/pieces/bootstrappers/rpm_common.sh
index 44c4625..fb12a51 100755
--- a/letsencrypt-auto-source/pieces/bootstrappers/rpm_common.sh
+++ b/letsencrypt-auto-source/pieces/bootstrappers/rpm_common.sh
@@ -54,6 +54,14 @@ BootstrapRpmCommon() {
ca-certificates
"
+ if [ ! -z $configure_cron ]; then
+ pkgs="$pkgs
+ vixie-cron
+ cronie
+ crontabs
+ "
+ fi
+
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment