From 718de2f88a75e0a546649f00b0def9588403509c Mon Sep 17 00:00:00 2001 From: Andriy Utkin Date: Thu, 10 Oct 2024 23:25:57 +0100 Subject: [PATCH 1/2] Merge cron jobs into one cron.d file --- debian/bluecherry.cron | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/debian/bluecherry.cron b/debian/bluecherry.cron index 6fef1ea1..ed3b1866 100644 --- a/debian/bluecherry.cron +++ b/debian/bluecherry.cron @@ -1,3 +1,14 @@ -# m h dom mon dow user command -0 0 * * * bluecherry /usr/share/bluecherry/backup_db.sh -30 0 * * * bluecherry curl -k https://localhost:7001/subdomainprovidercron +# This file is a part of bluecherry package. + +# .---------------- minute (0 - 59) +# | .------------- hour (0 - 23) +# | | .---------- day of month (1 - 31) +# | | | .------- month (1 - 12) OR jan,feb,mar,apr ... +# | | | | .---- day of week (0 - 6) (Sunday=0 or 7) OR sun,mon,tue,wed,thu,fri,sat +# | | | | | +# * * * * * user-name command to be executed +* * */5 * * root certbot renew --config-dir=/usr/share/bluecherry/nginx-includes/letsencrypt/ &> /var/log/bluecherry-letsencrypt.log +0 0 * * * bluecherry /usr/share/bluecherry/backup_db.sh +30 0 * * * bluecherry curl -k https://localhost:7001/subdomainprovidercron + +# vim: syntax=crontab From 43b43204b8fa40e2ac3b6a658f6bcfa67c9cdc12 Mon Sep 17 00:00:00 2001 From: Andriy Utkin Date: Thu, 10 Oct 2024 23:36:41 +0100 Subject: [PATCH 2/2] Deoccupy root's crontab Subdomain TLS certificate renewal jobs have been put to /etc/cron.d/bluecherry. Unobtrusively clear root's crontab from the remaining job entries. --- misc/postinstall.sh | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/misc/postinstall.sh b/misc/postinstall.sh index d1781db0..c3002254 100755 --- a/misc/postinstall.sh +++ b/misc/postinstall.sh @@ -158,6 +158,7 @@ function stop_apache # 1 - rpm install, 2 - rpm upgrade case "$1" in configure|reconfigure|1|2) + PREV_INSTALLED_VERSION=$2 if [[ $IN_DEB ]] then ucfr bluecherry /etc/bluecherry.conf @@ -446,8 +447,10 @@ case "$1" in install_certbot - # Install crontabs for subdomain renewal and SSL renewal using certbot - crontab -l 2>/dev/null || true; printf "* * */5 * * certbot renew --config-dir=/usr/share/bluecherry/nginx-includes/letsencrypt/ >/dev/null 2>&1\n*/5 * * * * curl -k https://localhost:7001/subdomainprovidercron >/dev/null 2>&1\n" | crontab - + # Clean root's crontab from entries which we previously put there + # FIXME one-time upgrade procedure would be nice. + # we have a nice way but use it only for mysql upgrades. + crontab -l 2>/dev/null | grep -v 'bluecherry\|subdomainprovidercron' | crontab - nginx -t 2>/dev/null > /dev/null