<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<atom:link href="https://dev1galaxy.org/extern.php?action=feed&amp;tid=7165&amp;type=rss" rel="self" type="application/rss+xml" />
		<title><![CDATA[Dev1 Galaxy Forum / [SOLVED] certbot renewal cron script]]></title>
		<link>https://dev1galaxy.org/viewtopic.php?id=7165</link>
		<description><![CDATA[The most recent posts in [SOLVED] certbot renewal cron script.]]></description>
		<lastBuildDate>Wed, 30 Apr 2025 07:17:07 +0000</lastBuildDate>
		<generator>FluxBB</generator>
		<item>
			<title><![CDATA[Re: [SOLVED] certbot renewal cron script]]></title>
			<link>https://dev1galaxy.org/viewtopic.php?pid=55457#p55457</link>
			<description><![CDATA[<p>As far as I understand, the package is created on the Debian side. The package creator thought about Debian users, implementing the transfer of control to systemd and about other good people... that&#039;s good.</p><p>The lack of a hook for restarting Apache is probably also somehow justified.</p><p>I changed the settings. Made updates weekly and added an action for Apache.</p>]]></description>
			<author><![CDATA[dummy@example.com (IdeaFix)]]></author>
			<pubDate>Wed, 30 Apr 2025 07:17:07 +0000</pubDate>
			<guid>https://dev1galaxy.org/viewtopic.php?pid=55457#p55457</guid>
		</item>
		<item>
			<title><![CDATA[Re: [SOLVED] certbot renewal cron script]]></title>
			<link>https://dev1galaxy.org/viewtopic.php?pid=55456#p55456</link>
			<description><![CDATA[<p>The point of running certbot more often is simply because a renewal attempt may fail for many possible technical reasons. If you set it up to only run once a month, any such failure would lead to needing operator hands-on.</p><p>Therefore all such renewal processes have &quot;busy wait&quot; design that begins with the test if it&#039;s yet time for a renewal and return as failure if not. If it is time for renewal, an actual renewal attempt is made, and that may succeed or fail for external reasons. If it fails, then the next run will again discover that it (still) is time for renewal and make another attempt. Etc. When the renewal succeeds,&#160; the local state changes so the next run will again opt out early because renewal is not (yet) needed.</p><p>Now, both that check for systemd and that randomized delay are unnecessary components. Your system does not need to check and re-check for the presence of systemd, since that is a constant.&#160; And you can choose a random but fixed start time&#160; for your certbot runs, which will be an equivalent collegial measure for avoiding clogging the remote end when actual renewal requests are made (there is no statistically motivated reason to pick a new random start time every time).</p>]]></description>
			<author><![CDATA[dummy@example.com (ralph.ronnquist)]]></author>
			<pubDate>Wed, 30 Apr 2025 00:38:12 +0000</pubDate>
			<guid>https://dev1galaxy.org/viewtopic.php?pid=55456#p55456</guid>
		</item>
		<item>
			<title><![CDATA[Re: [SOLVED] certbot renewal cron script]]></title>
			<link>https://dev1galaxy.org/viewtopic.php?pid=55452#p55452</link>
			<description><![CDATA[<p>As far as I understand the timer: The program &#039;certbot&#039; will be executed either by systemd.timers (if systemd is running) or by cron (in case of devuan).<br />No need for adjustments. Or I&#039;m just wrong.</p><p>It&#039;s kind of sick, that cron looks (or has to look) for systemd.timers, but anyway.</p>]]></description>
			<author><![CDATA[dummy@example.com (delgado)]]></author>
			<pubDate>Tue, 29 Apr 2025 20:32:11 +0000</pubDate>
			<guid>https://dev1galaxy.org/viewtopic.php?pid=55452#p55452</guid>
		</item>
		<item>
			<title><![CDATA[Re: [SOLVED] certbot renewal cron script]]></title>
			<link>https://dev1galaxy.org/viewtopic.php?pid=55450#p55450</link>
			<description><![CDATA[<p>I have a similar opinion on this issue. That&#039;s why I asked questions about the standard script. The frequency of script launch and the lack of hooks is most likely the responsibility of the maintainer in debian. I think he was guided by the recommendations of the certbot developers.</p><div class="codebox"><pre><code>test -x /usr/bin/certbot -a \! -d /run/systemd/system &amp;&amp; perl -e &#039;sleep int(rand(43200))&#039;</code></pre></div><p>This code raises questions for me.</p><p>Accordingly, it seems to me that the standard cron task is either not quite suitable for devuan or in principle needs to be improved by the administrator.</p>]]></description>
			<author><![CDATA[dummy@example.com (IdeaFix)]]></author>
			<pubDate>Tue, 29 Apr 2025 17:20:09 +0000</pubDate>
			<guid>https://dev1galaxy.org/viewtopic.php?pid=55450#p55450</guid>
		</item>
		<item>
			<title><![CDATA[Re: [SOLVED] certbot renewal cron script]]></title>
			<link>https://dev1galaxy.org/viewtopic.php?pid=55445#p55445</link>
			<description><![CDATA[<div class="quotebox"><blockquote><div><p>Does this mean that the apache2 service will reload (not restart) twice a day (*/12)? It&#039;s not scary, but it&#039;s not necessary. IMHO.</p></div></blockquote></div><p>If you tell the job to do it that is what it will do. I for one fail to see why you would be trying to renew a certification twice a day as it is. I would think a monthly job at the most would be the idea or depending on the length of the certificate a yearly job would most likely be the best. This twice a day foolishness in the comments make very little sense if their process is that useless it is needed I would not be trusting them for anything as critical as security of my website. You could do a separate script for the apache2 reload that wold test something like the date on certificate then it will only reload if it has changed.</p>]]></description>
			<author><![CDATA[dummy@example.com (RedGreen925)]]></author>
			<pubDate>Tue, 29 Apr 2025 13:54:38 +0000</pubDate>
			<guid>https://dev1galaxy.org/viewtopic.php?pid=55445#p55445</guid>
		</item>
		<item>
			<title><![CDATA[Re: [SOLVED] certbot renewal cron script]]></title>
			<link>https://dev1galaxy.org/viewtopic.php?pid=55444#p55444</link>
			<description><![CDATA[<p>One more question. Does this mean that the apache2 service will reload (not restart) twice a day (*/12)? It&#039;s not scary, but it&#039;s not necessary. IMHO.</p>]]></description>
			<author><![CDATA[dummy@example.com (IdeaFix)]]></author>
			<pubDate>Tue, 29 Apr 2025 11:47:43 +0000</pubDate>
			<guid>https://dev1galaxy.org/viewtopic.php?pid=55444#p55444</guid>
		</item>
		<item>
			<title><![CDATA[Re: [SOLVED] certbot renewal cron script]]></title>
			<link>https://dev1galaxy.org/viewtopic.php?pid=55412#p55412</link>
			<description><![CDATA[<div class="quotebox"><blockquote><div><p>Should i add --post-hook &quot;service apache2 reload&quot; to</p></div></blockquote></div><p>I would give. </p><div class="codebox"><pre><code>0 */12 * * * root test -x /usr/bin/certbot -a \! -d /run/systemd/system &amp;&amp; perl -e &#039;sleep int(rand(43200))&#039; &amp;&amp; certbot -q renew &amp;&amp; service apache2 reload</code></pre></div><p>A try using the same idea it does after the certbot renews the certificate perhaps even <strong>/etc/init.d/ apache2 reload</strong> 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.</p><div class="codebox"><pre><code>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  &gt; /dev/null 2&gt;&amp;1
## Run trim on my SSD drives every Saturday at 5am borrowed idea from MX Linux.
0 05 * * sat /root/bin/fstrim-MX.sh &gt; /dev/null 2&gt;&amp;1</code></pre></div>]]></description>
			<author><![CDATA[dummy@example.com (RedGreen925)]]></author>
			<pubDate>Thu, 24 Apr 2025 23:29:38 +0000</pubDate>
			<guid>https://dev1galaxy.org/viewtopic.php?pid=55412#p55412</guid>
		</item>
		<item>
			<title><![CDATA[Re: [SOLVED] certbot renewal cron script]]></title>
			<link>https://dev1galaxy.org/viewtopic.php?pid=55410#p55410</link>
			<description><![CDATA[<p>Dhould i add <em>--post-hook &quot;service apache2 reload&quot;</em> to </p><div class="codebox"><pre><code>0 */12 * * * root test -x /usr/bin/certbot -a \! -d /run/systemd/system &amp;&amp; perl -e &#039;sleep int(rand(43200))&#039; &amp;&amp; certbot -q renew</code></pre></div>]]></description>
			<author><![CDATA[dummy@example.com (IdeaFix)]]></author>
			<pubDate>Thu, 24 Apr 2025 22:09:20 +0000</pubDate>
			<guid>https://dev1galaxy.org/viewtopic.php?pid=55410#p55410</guid>
		</item>
		<item>
			<title><![CDATA[Re: [SOLVED] certbot renewal cron script]]></title>
			<link>https://dev1galaxy.org/viewtopic.php?pid=55391#p55391</link>
			<description><![CDATA[<div class="quotebox"><blockquote><div><p>should certbot deb package from Debian be patched for Devuan?</p></div></blockquote></div><p>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.</p>]]></description>
			<author><![CDATA[dummy@example.com (RedGreen925)]]></author>
			<pubDate>Wed, 23 Apr 2025 01:36:32 +0000</pubDate>
			<guid>https://dev1galaxy.org/viewtopic.php?pid=55391#p55391</guid>
		</item>
		<item>
			<title><![CDATA[Re: [SOLVED] certbot renewal cron script]]></title>
			<link>https://dev1galaxy.org/viewtopic.php?pid=55387#p55387</link>
			<description><![CDATA[<p>The main question is... should certbot deb package from Debian be patched for Devuan?</p><p>this cron task is from original package:</p><div class="codebox"><pre><code>0 */12 * * * root test -x /usr/bin/certbot -a \! -d /run/systemd/system &amp;&amp; perl -e &#039;sleep int(rand(43200))&#039; &amp;&amp; certbot -q renew</code></pre></div>]]></description>
			<author><![CDATA[dummy@example.com (IdeaFix)]]></author>
			<pubDate>Tue, 22 Apr 2025 19:08:47 +0000</pubDate>
			<guid>https://dev1galaxy.org/viewtopic.php?pid=55387#p55387</guid>
		</item>
		<item>
			<title><![CDATA[Re: [SOLVED] certbot renewal cron script]]></title>
			<link>https://dev1galaxy.org/viewtopic.php?pid=55382#p55382</link>
			<description><![CDATA[<div class="quotebox"><blockquote><div><p>Your cron entry misses the user field.</p></div></blockquote></div><p>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.</p>]]></description>
			<author><![CDATA[dummy@example.com (RedGreen925)]]></author>
			<pubDate>Tue, 22 Apr 2025 14:20:36 +0000</pubDate>
			<guid>https://dev1galaxy.org/viewtopic.php?pid=55382#p55382</guid>
		</item>
		<item>
			<title><![CDATA[Re: [SOLVED] certbot renewal cron script]]></title>
			<link>https://dev1galaxy.org/viewtopic.php?pid=55381#p55381</link>
			<description><![CDATA[<p>Your cron entry misses the user field. I made the same error in my cron entry tailor-made for acme.sh <img src="https://dev1galaxy.org/img/smilies/smile.png" width="15" height="15" alt="smile" /></p><p>May be you&#039;d need the full path of certbot, you just check it out, because I&#039;m not sure.</p>]]></description>
			<author><![CDATA[dummy@example.com (PedroReina)]]></author>
			<pubDate>Tue, 22 Apr 2025 06:58:16 +0000</pubDate>
			<guid>https://dev1galaxy.org/viewtopic.php?pid=55381#p55381</guid>
		</item>
		<item>
			<title><![CDATA[[SOLVED] certbot renewal cron script]]></title>
			<link>https://dev1galaxy.org/viewtopic.php?pid=55379#p55379</link>
			<description><![CDATA[<p>Hi.</p><p>Is it good for devuan?</p><div class="codebox"><pre><code>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&#039;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 &amp;&amp; perl -e &#039;sleep int(rand(43200))&#039; &amp;&amp; certbot -q renew</code></pre></div><p>I think about something loke this:</p><div class="codebox"><pre><code>0 */12 * * * root certbot renew --post-hook &quot;service apache2 reload&quot;</code></pre></div><p><del><span class="bbc">0&#160; 0,12 *&#160; *&#160; * certbot renew --post-hook &quot;service apache2 reload&quot;</span></del></p>]]></description>
			<author><![CDATA[dummy@example.com (IdeaFix)]]></author>
			<pubDate>Mon, 21 Apr 2025 16:49:46 +0000</pubDate>
			<guid>https://dev1galaxy.org/viewtopic.php?pid=55379#p55379</guid>
		</item>
	</channel>
</rss>
