srvrco / getssl

obtain free SSL certificates from letsencrypt ACME server Suitable for automating the process on remote servers.
GNU General Public License v3.0
2.1k stars 379 forks source link

On freebsd with default settings getssl script doesn't work from cron #576

Open vnv099 opened 4 years ago

vnv099 commented 4 years ago

I tried getssl script on 10.4-RELEASE-p13 FreeBSD. Just adding to crontab string like from readme - 23 5 * * * /root/scripts/getssl -u -a -q doesn't work, but from command line all working perfectly. It is something with PATH, that uses cron, because to solve this issue I had to make own script, set another PATH there and run it from crontab. Script is:

#!/usr/local/bin/bash
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/etc/rc.d
/usr/local/bin/getssl -w /etc/getssl -u -a
wurtel2 commented 4 years ago

What error message did it give? I wouldn't be surprised if it couldn't find curl or openssl. Note that you can add a PATH=... line to your crontab, so that getssl doesn't need to be wrapped in another script.

dawidi commented 3 years ago

I think the relevant difference that makes it work with your script isn't the PATH, but that you've explicitly specified the working directory using -w /etc/getssl.

I just ran into a very similar issue while moving my getssl instance from cron to a systemd timer.