Browsers not picking up new SSL certificate

You can't RUN that - it has to be added to CRON?
You aren't CRON are you?

2 Likes

Why can't he run it to test it? I lowered it to 40.

1 Like

He is not the CRON.
All hail the mighty CRON!

2 Likes

It's still commands though, right? Will it fail?

I just want to make sure nothing is broken in the cron task then silently failing

2 Likes

Your input will fail you!
&& will split the commands and run the second part now.

hmm...

Perhaps encapsulating the whole string within single quotes - to force is as one command, then maybe.

But he is still NOT the CRON ! - LOL

2 Likes

How could we detect a failure then?

2 Likes

Add it into CRON and wait.
[reduce the 43200 to 99 & the */12 (only every twelve hours) to * (every hour)]
You could do it more often like...
*/5 minutes, * hours
But you have to be sure to reduce the random wait time.

2 Likes

I figure it's probably the first part of that task (before the first &&) that was failing/filtering before. If that happens, certbot would never run, right?

2 Likes

Yeah the whole (run as) "root" and "test" if this exists, and "this" doesn't exist part...
Seems to require a very specific syntax - which may have gotten lost in translation.

2 Likes

That's exactly my fear. I did find this:

2 Likes

So it needs the "root" user definition.

2 Likes

That's part of the cron definition though, not the test command itself. Hence the sudo I added to run from the CL.

2 Likes

Gotta run for a bit. Back later.

2 Likes

You still don't get it.
The way CRON interprets the rest of that line implies one single command is to be read (red).
The way the CLI interprets && can be different.

2 Likes

I agree there. I was just meaning the root was part of the cron syntax.

1 Like

Maybe like this:

sudo "test -x /usr/bin/certbot -a \! -d /run/systemd/system && sudo perl -e 'sleep int(rand(40))' && sudo certbot -q renew"

[YMMV]

2 Likes

I'd like to see it broken down into individual pieces executed. Just to see how it fits (or doesn't fit) together.

Personally, I don't see the value in repeatedly testing if certbot is executable by root.

2 Likes

But that is not the test.
There is an "AND NOT" there.

It reads [in geEkNGLISH]...
If /usr/bin/certbot can be executed AND directory /run/systemd/system doesn't exist, then:
Sleep for a random amount of time (less than 12 hours) and then run:
certbot -q renew

2 Likes

Here's an example directly from the stackexchange topic I shared:

test -1 -gt -2 && echo yes would print yes

-1 is clearly greater than -2, so echo yes

I think if you run this in Linux straight from the CL you'll get yes.

2 Likes

Why do we care if that directory exists, I wonder?

2 Likes