More cron job fail

0 0 * * * sleep $RANDOM && /usr/bin/bash -l -c /usr/bin/certbot -n renew

In reference to Cron job fails to renew certificate

bash now requires the "-l" and "-c" to be specified explicitly in the cron job which I swear it did not before but that's the same way it's always worked according to them, and well, it's par for the course because there's always going to be a proprietary "closed shop" somewhere working overtime to cripple my business and earn heavy consultancy fees at my expense by wrecking anything technical they can get their hands on behind the scenes.

You don't have to use bash, you know. /bin/sh works fine.

2 Likes

Usually that's just a symlink to bash I think?

2 Likes

Depends on the distro (and maybe on user choice). @justinacolmena said they're running CentOS, here it's indeed a symlink to bash though bash runs in a special POSIX mode when invoked through /bin/sh.

Other distros may use different shells, for example Debian/Ubuntu use dash.

4 Likes

It can be, bash, dash or zsh. But it's not running the same as bash, it's as if you ran bash --posix.

2 Likes

Or even busybox. That’s a lot of fun.

2 Likes

This cron job is entering interactive mode when it runs.

The way you have written the bash command out, certbot isn't receiving the -n renew arguments.

It's just running certbot, which is why it's interactive.

3 Likes

Try putting quotes around the entire -c command. Without quotes certbot won't see the options.

2 Likes