bash: lego: command not found

peps03

Verified User
Joined
Oct 24, 2013
Messages
206
Location
Amsterdam
I've installed LEGO Version 4.1.2. via the Custombuild > Build Software > "Build" button to a few VPSses.

Then running the LEGO command as described here: https://go-acme.github.io/lego/usage/cli/examples/ works well on a few servers, but returns:
"bash: lego: command not found" on a few others.

Any idea? Not sure what i'm missing. Google hasn't helped me yet. Thanks.
 
letsencrypt.sh should be used to manage the certificates, it calls lego binary automatically.
 
Thanks for your reply. It raises 2 questions.

1. Can I also somehow use the lego script, from this example below that works on some VPSses, on the VPSses on which it doesn't work? (Which returns: bash: lego: command not found)
Code:
$ [email protected] \ CLOUDFLARE_API_KEY=b9841238feb177a84330febba8a83208921177bffe733 \ lego --dns cloudflare --domains www.example.com --email [email protected] run

2. Or, how do i use letsencrypt.sh to renew the host certificate and use LEGO for it? (As the hostname runs behind Cloudflare).
 
Just use user-level of DA to generate the cert, it let's you specify CloudFlare details for wildcard certificates :) Any problems with that?
 
Not fully sure what you mean by using the user level to generate the host name cert. I understand it, but it doesn't suite our needs probably.

How i have this proces set up now (and how i'd like it to work) is:
1. LEGO installed (as described above)
2. Using Alex's script to install the generated CERT, he updated it to work with LEGO certs: https://github.com/poralix/directadmin-utils/tree/master/ssl
3. I set a cron to run every 5 days and update the CERT only if it is valid for less than 6 days.

Running all manually works great.
But when the cron runs, it returns: bash: lego: command not found, in some cases.

Although some other VPSses running at AWS return 'bash: lego: command not found' also when ran manually.
 
I think /usr/local/bin is not in PATH of your cronjob vars. Try ln -s /usr/local/bin/lego /usr/bin/lego, or just adjust PATH in cronjob.
 
I moved the cronjob content to a separate script for testing.

Code:
[root@vps custom]# ./run_lego_cert_update.sh
./run_lego_cert_update.sh: line 3:  /usr/local/bin/lego: No such file or directory
[root@vps custom]# ls -l /usr/local/bin/lego
-rwx------. 1 root root 33001472 Nov 21 21:37 /usr/local/bin/lego

What am I doing wrong?
 
or just adjust PATH in cronjob.
Yep! :)
This did the trick, many thanks!!


1 issue remains. I've installed LEGO via the Custombuild > Build Software > "Build" button to a few other VPSses running at AWS, but LEGO does NOT seem to get installed:

Code:
[root@vps centos]# lego --version
bash: lego: command not found
[root@vps centos]# type lego
bash: type: lego: not found
[root@vps centos]#
 
Never mind.. using the full path on these other vpsses also works. ?

Code:
/usr/local/bin/lego
 
Back
Top