Acme.sh: add an option to re-try in debug mode

Created on 23 Sep 2016  路  11Comments  路  Source: acmesh-official/acme.sh

when acme.sh fails to issue a certificate due to various errors like dns, verification failures etc, would be nice if you could automatically re-try but with --debug 2 flag enabled for the 2nd attempt ?

maybe a new flag like --debug-retry which triggers a re-try with --debug 2 ?

All 11 comments

@centminmod
There is already some retry logic in the code. you can search for "retry" keyword.

It should retry if there is fatal error in the process.

Anyway, Please give me give me more details, let me think about it.

well currently if a user runs acme.sh issue and it fails, they have to run it again with --debug 2

the suggestion is to be able to auto re-run with --debug 2 enabled again.

@centminmod
OK.
I'm adding a LOG_LEVEL option, which works together with the LOG_FILE option.

It can log the process. if error happens, the user can check the log file.

Is that ok?

so that would log the same detailed verbose output as --debug 2 ? if so that would be perfect :)

Fixed at: a73c5b3355c6afb889363ca486db82c0946b1702

https://github.com/Neilpang/acme.sh/wiki/Enable-acme.sh-log

the link to https://github.com/Neilpang/acme.sh/wiki/How-to-debug-acme.sh might confuse users of my acmetool.sh wrapper that uses acme.sh as the method used to debug would slightly differ https://community.centminmod.com/posts/36908/

an option to disable the link to https://github.com/Neilpang/acme.sh/wiki/How-to-debug-acme.sh or edit it ?

seem to be getting an error if i set log-level ?

/root/.acme.sh/acme.sh --staging --issue -d acme.domain.com -w /home/nginx/domains/acme.domain.com/public -k 2048 --useragent centminmod-centos7-acmesh-webroot --log /root/centminlogs/acmetool.sh-debug-log-260916-173926 --log-level 2
/root/.acme.sh/acme.sh: line 136: [: --log-level: integer expression expected

actually happens earlier on acme.sh update runs too

./acme.sh: line 136: [: --log-level: integer expression expected
./acme.sh: line 136: [: --log-level: integer expression expected
./acme.sh: line 136: [: --log-level: integer expression expected
./acme.sh: line 136: [: --log-level: integer expression expected
[Mon Sep 26 17:53:26 UTC 2016] Installing to /root/.acme.sh
[Mon Sep 26 17:53:26 UTC 2016] Installed to /root/.acme.sh/acme.sh
./acme.sh: line 136: [: --log-level: integer expression expected
./acme.sh: line 127: [: --log-level: integer expression expected
./acme.sh: line 136: [: --log-level: integer expression expected
./acme.sh: line 127: [: --log-level: integer expression expected
./acme.sh: line 117: [: --log-level: integer expression expected
./acme.sh: line 136: [: --log-level: integer expression expected
./acme.sh: line 127: [: --log-level: integer expression expected
[Mon Sep 26 17:53:26 UTC 2016] OK, Close and reopen your terminal to start using acme.sh
./acme.sh: line 136: [: --log-level: integer expression expected
./acme.sh: line 127: [: --log-level: integer expression expected
./acme.sh: line 136: [: --log-level: integer expression expected
./acme.sh: line 127: [: --log-level: integer expression expected
./acme.sh: line 136: [: --log-level: integer expression expected
./acme.sh: line 127: [: --log-level: integer expression expected
./acme.sh: line 136: [: --log-level: integer expression expected
./acme.sh: line 127: [: --log-level: integer expression expected
./acme.sh: line 136: [: --log-level: integer expression expected
./acme.sh: line 127: [: --log-level: integer expression expected
./acme.sh: line 136: [: --log-level: integer expression expected
./acme.sh: line 127: [: --log-level: integer expression expected
./acme.sh: line 136: [: --log-level: integer expression expected
[Mon Sep 26 17:53:26 UTC 2016] Installing cron job
0 0 * * * "/root/.acme.sh"/acme.sh --cron --home "/root/.acme.sh" > /dev/null
./acme.sh: line 136: [: --log-level: integer expression expected
[Mon Sep 26 17:53:26 UTC 2016] Good, bash is installed, change the shebang to use bash as prefered.
[Mon Sep 26 17:53:26 UTC 2016] OK
./acme.sh: line 136: [: --log-level: integer expression expected
./acme.sh: line 127: [: --log-level: integer expression expected
https://github.com/Neilpang/acme.sh
v2.5.8

bash -x output segment from acme.sh issue run

+ '[' 8 -gt 0 ']'
+ case "${1}" in
+ _keylength=2048
+ '[' '' = no ']'
+ shift
+ shift 1
+ '[' 6 -gt 0 ']'
+ case "${1}" in
+ _useragent=centminmod-centos7-acmesh-webroot
+ USER_AGENT=centminmod-centos7-acmesh-webroot
+ shift
+ shift 1
+ '[' 4 -gt 0 ']'
+ case "${1}" in
+ _log=1
+ _logfile=/root/centminlogs/acmetool.sh-debug-log-260916-175936.log
+ '[' -z /root/centminlogs/acmetool.sh-debug-log-260916-175936.log ']'
+ _startswith /root/centminlogs/acmetool.sh-debug-log-260916-175936.log -
+ _str=/root/centminlogs/acmetool.sh-debug-log-260916-175936.log
+ _sub=-
+ echo /root/centminlogs/acmetool.sh-debug-log-260916-175936.log
+ grep '^-'
+ shift
+ LOG_FILE=/root/centminlogs/acmetool.sh-debug-log-260916-175936.log
+ '[' -z '' ']'
+ LOG_LEVEL=1
+ shift 1
+ '[' 2 -gt 0 ']'
+ case "${1}" in
+ _log_level=--log-level
+ LOG_LEVEL=--log-level
+ shift
+ shift 1
+ '[' 0 -gt 0 ']'
+ '[' issue '!=' install ']'
+ __initHome
+ '[' -z '' ']'
+ _exists readlink
+ cmd=readlink
+ '[' -z readlink ']'
+ type command
+ command -v readlink
+ ret=0
+ _debug3 'readlink exists=0'
+ '[' --log-level ']'
+ '[' --log-level -ge 3 ']'
/root/.acme.sh/acme.sh: line 136: [: --log-level: integer expression expected
+ '[' '' ']'
+ return 0
+ _exists dirname
+ cmd=dirname
+ '[' -z dirname ']'
+ type command
+ command -v dirname
+ ret=0
+ _debug3 'dirname exists=0'
+ '[' --log-level ']'
+ '[' --log-level -ge 3 ']'
/root/.acme.sh/acme.sh: line 136: [: --log-level: integer expression expected
+ '[' '' ']'
+ return 0
+ _debug 'Lets guess script dir.'
+ '[' -z --log-level ']'
+ '[' --log-level -ge 1 ']'
/root/.acme.sh/acme.sh: line 117: [: --log-level: integer expression expected

@centminmod
Sorry, it was a typo.

@centminmod

The default log level is: 1
which logs same as the --debug detail.

you can set log level to: 2,

which logs same as --debug 2

@Neilpang cheers looks to be working https://community.centminmod.com/posts/36941/ 馃憤

Was this page helpful?
0 / 5 - 0 ratings

Related issues

extensionsapp picture extensionsapp  路  4Comments

caruccio picture caruccio  路  5Comments

haiopaii picture haiopaii  路  3Comments

extensionsapp picture extensionsapp  路  3Comments

mskian picture mskian  路  3Comments