You are unable. Sorry.
Feb 23 00:00:01 localhost CRON[24186]: (root) CMD (root test -x /usr/bin/certbot -a ! -d /run/systemd/system && pe
rl -e 'sleep int(rand(43200))' && certbot -q renew --deploy-hook "/usr/local/lsws/bin/lswsctrl restart")
Feb 23 00:00:01 localhost CRON[24187]: (root) CMD (test -x /usr/bin/certbot -a ! -d /run/systemd/system && perl -e
'sleep int(rand(43200))' && certbot -q renew)
Feb 23 00:09:01 localhost CRON[24311]: (root) CMD ( [ -x /usr/lib/php/sessionclean ] && if [ ! -d /run/systemd/sys
tem ]; then /usr/lib/php/sessionclean; fi)
Feb 23 00:17:01 localhost CRON[24513]: (root) CMD ( cd / && run-parts --report /etc/cron.hourly)
Feb 23 00:39:01 localhost CRON[24876]: (root) CMD ( [ -x /usr/lib/php/sessionclean ] && if [ ! -d /run/systemd/sys
tem ]; then /usr/lib/php/sessionclean; fi)
Feb 23 00:51:01 localhost CRON[25079]: (root) CMD (certbot renew -q)
Feb 23 00:54:01 localhost CRON[25156]: (root) CMD (certbot renew -q)
Feb 23 00:57:01 localhost CRON[25203]: (root) CMD (certbot renew -q)
I only copied today's lines. There's a lot more.
Bingo !
We win ! ! ! !
Ooh buddy!
Now we can set it to run at 2:17 AM every day...
17 2 * * * certbot renew -q
Now you can put back what you had before:
You always need to incorporate a randomizing sleep timer [best practice].
Or that...
Does it need to be randomly delayed?
I regularly practice randomly sleeping at any give time of the day!
What if that string of commands were failing for some reason?
We could just execute it once from the command line just to be sure...
test -x /usr/bin/certbot -a ! -d /run/systemd/system && perl -e 'sleep int(rand(43200))' && certbot -q renew
ok, I pasted in what you gave me. Just one quick question, previously I had the above line but with ...-a /! -d...
Does that slash need to be there or not be there? I don't know what any of that line means except the time and the 'renew', haha.
CORRECTION: it was two edits ago that the slash was there. My bad. I just commented-out the old lines in case I need to go back to them. Forget my babbling about the slash.
I actually would improve upon the 43200 by reducing that by double the longest expected time for certbot would require to complete minus one more hour (3600).
But why?
Because, as unlikely as it might seem, random numbers could be drawn in such an order (43200 then 0) that certbot would wait to run and then be called to run before the first run has time to finish running.
Ok that makes sense... but what about that extra hour (3600 seconds) you subtracted?
Well, I'm glad you asked.
That is to offset the start time away from even the remote possibility of running even close to midnight (in whatever time zone you might be in).
Wait a minute! But wouldn't that just put you into someone else's time zone / midnight?
Well someone's paying close attention!
Yes; yes it would.
But it would randomly scatter you on to 11 other time zones.
And doing this might seem balanced.
But it is NOT; as not all time zones are balanced.
Thus, the heaviest ones would get scattered the most.
So...it doesn't work. Output:
Command 'root' not found, but can be installed with:
snap install root-framework
What exactly was in there before?
[I just copied your line and removed the obvious stuff no longer needed]
You lost me at
because I have no idea how long it would take it to complete. But otherwise your logic seems sound! I'm a little out of my element here...
I have no idea. I got it from a youtube video on onepagezen...?
I found this:
0 */12 * * * test -x /usr/bin/certbot -a \! -d /run/systemd/system && perl -e 'sleep int(rand(43200))' && certbot -q renew
Seems pretty much the same but without "root".
And the added backslash "\".
Try it without the root.
That's my bad.
Might need sudos
nothing happens at all. Is that good?
If my math is right...
...carry the two...
My amended sleeper would look something like this:
0 [*/12]+1 * * * test -x /usr/bin/certbot -a \! -d /run/systemd/system && perl -e 'sleep int(rand(39000))' && certbot -q renew
But who knows that might blowup and start a digital fire that may burn down the entire Internet!
LOL
sudo test -x /usr/bin/certbot -a \! -d /run/systemd/system && sudo perl -e 'sleep int(rand(40))' && sudo certbot -q renew