No installers found when run from cron


#1

I have a script that works when running from the command line (as root). However, if I cron it (as root, every 70 days), it gives me:

Updating letsencrypt and virtual environment dependencies…
Running with virtualenv: /root/.local/share/letsencrypt/bin/letsencrypt --renew-by-default
No installers seem to be present and working on your system; fix that or try running letsencrypt with the “certonly” command

Here’s the script:

#!/bin/bash

cd /etc/letsencrypt/letsencrypt-tool

rm /tmp/certrenewal

echo “Starting renewal SSL Certificate Renewal for WWW.” >> /tmp/certrenewal
echo " " >> /tmp/certrenewal

echo “Creating, signing and installing new certificate for WWW:” >> /tmp/certrenewal
echo " " >> /tmp/certrenewal

echo “1” | ./letsencrypt-auto --renew-by-default >> /tmp/certrenewal 2>> /tmp/certrenewal

cat /tmp/certrenewal | mail -s “Let’s Encrypt SSL Certificate Renewal for WWW” administrator@mydomain.mb.ca

Here’s /etc/cli.ini:

authenticator = webroot
webroot-path = /var/www

# only use for testing
#server = https://acme-staging.api.letsencrypt.org/directory

domains = www.mydomain.mb.ca

text = True

Why would putting it in a cron job make it fail to detect Apache?


#2

Maybe this info helps: https://askubuntu.com/questions/23009/reasons-why-crontab-does-not-work/23438#23438


#3

That solved it. I set the PATH variable (to be the same as when logged in) at the begining of the script. It now works from the cron.