Skip to content

Commit

Permalink
Deoccupy root's crontab
Browse files Browse the repository at this point in the history
Put subdomain TLS certificate renewal jobs to a /etc/cron.d/ file with a
name which clearly marks its association.

Unobtrusively clear root's crontab from the remaining job entries.
  • Loading branch information
andrey-utkin committed Dec 19, 2023
1 parent 83823ac commit e2bc876
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
13 changes: 13 additions & 0 deletions misc/cron/bluecherry-subdomain-cert-renewal
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# 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/ >/dev/null 2>&1
*/5 * * * * root curl -k https://localhost:7001/subdomainprovidercron >/dev/null 2>&1

# vim: syntax=crontab
4 changes: 3 additions & 1 deletion misc/postinstall.sh
Original file line number Diff line number Diff line change
Expand Up @@ -419,7 +419,9 @@ case "$1" in
/usr/local/bin/pip3 install pyopenssl --upgrade

# 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 -
install --mode 600 cron/bluecherry-subdomain-cert-renewal /etc/cron.d
# Clean root's crontab from entries which we previously put there
crontab -l 2>/dev/null | grep -v 'bluecherry\|subdomainprovidercron' | crontab -


nginx -t 2>/dev/null > /dev/null
Expand Down

0 comments on commit e2bc876

Please sign in to comment.