escaping double quotes and percent signs (%) in cron

You have to escape the % signs. They have a special meaning in crontabs: man (5) crontab: Percent-signs (%) in the command, unless escaped with backslash (\), will be changed into newline characters, and all data after the first % will be sent to the command as standard input.

Prevent duplicate cron jobs running

There are a couple of programs that automate this feature, take away the annoyance and potential bugs from doing this yourself, and avoid the stale lock problem by using flock behind the scenes, too (which is a risk if you’re just using touch). I’ve used lockrun and lckdo in the past, but now there’s flock(1) … Read more

Cron job for let’s encrypt renewal

Monthly is not frequent enough. This script should run at least weekly, and preferably daily. Remember that certs don’t get renewed unless they are near to expiration, and monthly could cause your existing certs to occasionally be expired already before they get renewed. The name of the program is certbot, which was renamed from letsencrypt. … Read more

Running a cron job manually and immediately

Here’s what I did, and it seems to work in this situation. At least, it shows me an error, whereas running from the command line as the user doesn’t show the error. Step 1: I put this line temporarily in the user’s crontab: * * * * * /usr/bin/env > /home/username/tmp/cron-env then took it out … Read more

Are uploads directories created on a schedule?

I believe by default these folders are created by user interaction, however, it’s possible that a plugin may be calling a function to create these monthly upload folders. Note that using this function will create a subfolder in your Uploads folder corresponding to the queried month (or current month, if no $time argument is provided), … Read more