The officially official Devuan Forum!

You are not logged in.

#1 2025-04-21 16:49:46

IdeaFix
Member
Registered: 2020-01-02
Posts: 23  
Website

certbot renewal cron script

Hi.

Is it good for devuan?

cat /etc/cron.d/certbot
# /etc/cron.d/certbot: crontab entries for the certbot package
#
# Upstream recommends attempting renewal twice a day
#
# Eventually, this will be an opportunity to validate certificates
# haven't been revoked, etc.  Renewal will only occur if expiration
# is within 30 days.
#
# Important Note!  This cronjob will NOT be executed if you are
# running systemd as your init system.  If you are running systemd,
# the cronjob.timer function takes precedence over this cronjob.  For
# more details, see the systemd.timer manpage, or use systemctl show
# certbot.timer.
SHELL=/bin/sh
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin

0 */12 * * * root test -x /usr/bin/certbot -a \! -d /run/systemd/system && perl -e 'sleep int(rand(43200))' && certbot -q renew

I think about something loke this:

0 */12 * * * root certbot renew --post-hook "service apache2 reload"

0  0,12 *  *  * certbot renew --post-hook "service apache2 reload"

Last edited by IdeaFix (2025-04-24 22:12:01)

Offline

#2 2025-04-22 06:58:16

PedroReina
Member
From: Madrid, Spain
Registered: 2019-01-13
Posts: 282  
Website

Re: certbot renewal cron script

Your cron entry misses the user field. I made the same error in my cron entry tailor-made for acme.sh smile

May be you'd need the full path of certbot, you just check it out, because I'm not sure.

Last edited by PedroReina (2025-04-23 08:52:16)

Offline

#3 2025-04-22 14:20:36

RedGreen925
Member
Registered: 2024-12-07
Posts: 107  

Re: certbot renewal cron script

Your cron entry misses the user field.

Also has error with the 0,12 instead of the properly shown 0/12 for every twelve hours in the example above it for the hour to run field.

Offline

#4 2025-04-22 19:08:47

IdeaFix
Member
Registered: 2020-01-02
Posts: 23  
Website

Re: certbot renewal cron script

The main question is... should certbot deb package from Debian be patched for Devuan?

this cron task is from original package:

0 */12 * * * root test -x /usr/bin/certbot -a \! -d /run/systemd/system && perl -e 'sleep int(rand(43200))' && certbot -q renew

Last edited by IdeaFix (2025-04-24 22:10:00)

Offline

#5 2025-04-23 01:36:32

RedGreen925
Member
Registered: 2024-12-07
Posts: 107  

Re: certbot renewal cron script

should certbot deb package from Debian be patched for Devuan?

No it tells you that changes are needed if running systemd which Devuan does not do so it is proper as it is. The line in the package is correct, the line you suggest to use is the one that is wrongly formatted with the 0,12 shown by you.

Offline

#6 2025-04-24 22:09:20

IdeaFix
Member
Registered: 2020-01-02
Posts: 23  
Website

Re: certbot renewal cron script

Dhould i add --post-hook "service apache2 reload" to

0 */12 * * * root test -x /usr/bin/certbot -a \! -d /run/systemd/system && perl -e 'sleep int(rand(43200))' && certbot -q renew

Offline

#7 2025-04-24 23:29:38

RedGreen925
Member
Registered: 2024-12-07
Posts: 107  

Re: certbot renewal cron script

Should i add --post-hook "service apache2 reload" to

I would give.

0 */12 * * * root test -x /usr/bin/certbot -a \! -d /run/systemd/system && perl -e 'sleep int(rand(43200))' && certbot -q renew && service apache2 reload

A try using the same idea it does after the certbot renews the certificate perhaps even /etc/init.d/ apache2 reload as the command to ensure no stupid path problems as happens with cron as it does not have the same path as the user does when it tries to execute commands. I always do this with my entries to ensure it has no choice but to do what I tell it to do. For example my root crontab.

root@9600k:~# crontab -l
# Edit this file to introduce tasks to be run by cron.
# 
# Each task to run has to be defined through a single line
# indicating with different fields when the task will be run
snip....
# m h  dom mon dow   command

## Run my rsync snapshot script at fifteen minutes after it every four hours.
15 */4 * * * /root/bin/snapshot_root.sh  > /dev/null 2>&1
## Run trim on my SSD drives every Saturday at 5am borrowed idea from MX Linux.
0 05 * * sat /root/bin/fstrim-MX.sh > /dev/null 2>&1

Offline

Board footer