Same problem as always,
cron(8) has a limited path which doesn't include
/usr/local/bin.
That's not correct … The default PATH for jobs executed via cron is set to
/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin
. See the
crontab(5) manual page.
To analyze the problem, you should first make sure that email delivery works for the output from cron jobs. To do that, temporarily create an entry
* * * * * nonexist
. It should create an email message every minute. If it doesn't, fix your email setup first. If you can't fix it, an alternative way to get the output would be this:
Code:
0 0 1 * * /bin/sh -c "certbot renew" >/root/crondebug.output 2>&1
Note that you should not write the file to /tmp. Use a directory that is only writable by yourself (in this case, root).
Now, if the cron job produces any error messages, they should be written to the file given, indicating the cause of the problem.
That leaves only the case that the command is started successfully by cron, but the command itself fails silently. That will be more difficult to debug. If certbot is a shell script, you could start the shell with the
-x
option to get a list of the actual commands executed, so you can see at which point it is failing. Similar ways exist for other scripting languages (Python, Perl, …).
If it's a binary, it's more difficult. Check if the documentation mentions any debug or verbosity options. If everything else fails, run the program with
truss(1) or
ktrace(1) to see if any system calls are failing, but the output might be difficult to read for non-developers.