Skip to content

Commit 798d295

Browse files
committed
WIP Deoccupy root's crontab
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.
1 parent f0f4472 commit 798d295

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# This file is a part of bluecherry package.
2+
3+
# .---------------- minute (0 - 59)
4+
# | .------------- hour (0 - 23)
5+
# | | .---------- day of month (1 - 31)
6+
# | | | .------- month (1 - 12) OR jan,feb,mar,apr ...
7+
# | | | | .---- day of week (0 - 6) (Sunday=0 or 7) OR sun,mon,tue,wed,thu,fri,sat
8+
# | | | | |
9+
# * * * * * user-name command to be executed
10+
* * */5 * * root certbot renew --config-dir=/usr/share/bluecherry/nginx-includes/letsencrypt/ >/dev/null 2>&1
11+
*/5 * * * * root curl -k https://localhost:7001/subdomainprovidercron >/dev/null 2>&1
12+
13+
# vim: syntax=crontab

misc/postinstall.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -421,7 +421,9 @@ case "$1" in
421421
/usr/local/bin/pip3 install pyopenssl --upgrade
422422

423423
# Install crontabs for subdomain renewal and SSL renewal using certbot
424-
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 -
424+
install --mode 600 cron/bluecherry-subdomain-cert-renewal /etc/cron.d
425+
# Clean root's crontab from entries which we previously put there
426+
crontab -l 2>/dev/null | grep -v 'bluecherry\|subdomainprovidercron' | crontab -
425427

426428

427429
nginx -t 2>/dev/null > /dev/null

0 commit comments

Comments
 (0)