How do you get variable values within the reloadcmd script file? Followup
https://github.com/acmesh-official/acme.sh/issues/6275
Sorry to keep laboring the point, however I think I'm running into the same issue as mentioned: https://github.com/acmesh-official/acme.sh/issues/558
My reloadscript is the following:
testreload.sh (755 permissions)
var=$(_readdomainconf "Le_RealFullChainPath")
echo "Var: ${var}"
mydomain=$(_readdomainconf Le_domain)
echo "Domain: ${mydomain}"
It's being invoked by the following command line:
./acme.sh --install-cert -d test3.domain.com --ecc --key-file /etc/ssl/letsencrypt/test3.domain.com/key.pem --fullchain-file /etc/ssl/letsencrypt/test3.domain.com/fullchain.pem --cert-file /etc/ssl/letsencrypt/test3.domain.com/cert.pem --ca-file /etc/ssl/letsencrypt/test3.domain.com/ca.pem --reloadcmd "/root/.acme.sh/test3.domain.com_ecc/testreload.sh"
Output:
/root/.acme.sh/test3.domain.com_ecc/testreload.sh: line 1: _readdomainconf: command not found
Clearly I'm running into same issue with this external script referencing a function within the main acme.sh script that the external script doesn't know exists. Could you provide some further guidance as this issue was originally raised in 2017 and I haven't found any appropriate workaround combing through the issues here.
Please upgrade to the latest code and try again first. Maybe it's already fixed. acme.sh --upgrade If it's still not working, please provide the log with --debug 2, otherwise, nobody can help you.
Here is debug output:
# /acme.sh --install-cert -d test3.domain.com --ecc --key-file /etc/ssl/letsencrypt/test3.domain.com/key.pem --fullchain-file /etc/ssl/letsencrypt/test3.domain.com/fullchain.pem --cert-file /etc/ssl/letsencrypt/test3.domain.com/cert.pem --ca-file /etc/ssl/letsencrypt/test3.domain.com/ca.pem --reloadcmd "/root/.acme.sh/test3.domain.com_ecc/testreload.sh" --debug 2
[Sat Mar 22 08:19:58 AM CDT 2025] Let's find the script directory.
[Sat Mar 22 08:19:58 AM CDT 2025] _SCRIPT_='./acme.sh'
[Sat Mar 22 08:19:58 AM CDT 2025] _script='/root/.acme.sh/acme.sh'
[Sat Mar 22 08:19:58 AM CDT 2025] _script_home='/root/.acme.sh'
[Sat Mar 22 08:19:58 AM CDT 2025] Using default home: /root/.acme.sh
[Sat Mar 22 08:19:58 AM CDT 2025] Using config home: /root/.acme.sh
[Sat Mar 22 08:19:58 AM CDT 2025] LE_WORKING_DIR='/root/.acme.sh'
https://github.com/acmesh-official/acme.sh
v3.1.0
[Sat Mar 22 08:19:58 AM CDT 2025] Running cmd: installcert
[Sat Mar 22 08:19:58 AM CDT 2025] Using config home: /root/.acme.sh
[Sat Mar 22 08:19:58 AM CDT 2025] default_acme_server='https://acme-v02.api.letsencrypt.org/directory'
[Sat Mar 22 08:19:58 AM CDT 2025] ACME_DIRECTORY='https://acme-v02.api.letsencrypt.org/directory'
[Sat Mar 22 08:19:58 AM CDT 2025] _ACME_SERVER_HOST='acme-v02.api.letsencrypt.org'
[Sat Mar 22 08:19:58 AM CDT 2025] _ACME_SERVER_PATH='directory'
[Sat Mar 22 08:19:58 AM CDT 2025] DOMAIN_PATH='/root/.acme.sh/test3.domain.com_ecc'
[Sat Mar 22 08:19:59 AM CDT 2025] Installing cert to: /etc/ssl/letsencrypt/test3.domain.com/cert.pem
[Sat Mar 22 08:19:59 AM CDT 2025] Installing CA to: /etc/ssl/letsencrypt/test3.domain.com/ca.pem
[Sat Mar 22 08:19:59 AM CDT 2025] Installing key to: /etc/ssl/letsencrypt/test3.domain.com/key.pem
[Sat Mar 22 08:19:59 AM CDT 2025] Installing full chain to: /etc/ssl/letsencrypt/test3.domain.com/fullchain.pem
[Sat Mar 22 08:19:59 AM CDT 2025] Running reload cmd: /root/.acme.sh/test3.domain.com_ecc/testreload.sh
/root/.acme.sh/test3.domain.com_ecc/testreload.sh: line 3: _readdomainconf: command not found
Var:
/root/.acme.sh/test3.domain.com_ecc/testreload.sh: line 6: _readdomainconf: command not found
Domain:
[Sat Mar 22 08:19:59 AM CDT 2025] Reload successful
Sorry, it's my mistake. please use a deploy-hook script, so that you can use _readdomainconf in it.
https://github.com/acmesh-official/acme.sh/wiki/deployhooks
It's almost the same as a reloadcmd script. just see any of the example: https://github.com/acmesh-official/acme.sh/blob/master/deploy/myapi.sh
Anyway, if you just need another envariable for your reloadcmd, I can add it for you. give me a list.