mirror of
https://github.com/plantroon/acme.sh.git
synced 2024-12-22 13:11:41 +00:00
fix error message for cron job
This commit is contained in:
parent
8abd3e90aa
commit
01ba821632
28
le.sh
28
le.sh
@ -209,10 +209,10 @@ _setopt() {
|
|||||||
_startserver() {
|
_startserver() {
|
||||||
content="$1"
|
content="$1"
|
||||||
while true ; do
|
while true ; do
|
||||||
if [ -z "$DEBUG" ] ; then
|
if [ "$DEBUG" ] ; then
|
||||||
echo -e -n "HTTP/1.1 200 OK\r\n\r\n$content" | nc -q 1 -l -p 80 > /dev/null
|
|
||||||
else
|
|
||||||
echo -e -n "HTTP/1.1 200 OK\r\n\r\n$content" | nc -q 1 -l -p 80
|
echo -e -n "HTTP/1.1 200 OK\r\n\r\n$content" | nc -q 1 -l -p 80
|
||||||
|
else
|
||||||
|
echo -e -n "HTTP/1.1 200 OK\r\n\r\n$content" | nc -q 1 -l -p 80 2>&1 > /dev/null
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
@ -225,6 +225,7 @@ _stopserver() {
|
|||||||
killall -s 9 nc 2>&1
|
killall -s 9 nc 2>&1
|
||||||
else
|
else
|
||||||
kill -s 9 $pid 2>&1 > /dev/null
|
kill -s 9 $pid 2>&1 > /dev/null
|
||||||
|
wait $pid 2>/dev/null
|
||||||
killall -s 9 nc 2>&1 > /dev/null
|
killall -s 9 nc 2>&1 > /dev/null
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
@ -415,7 +416,7 @@ issue() {
|
|||||||
_send_signed_request $uri "{\"resource\": \"challenge\", \"keyAuthorization\": \"$keyauthorization\"}"
|
_send_signed_request $uri "{\"resource\": \"challenge\", \"keyAuthorization\": \"$keyauthorization\"}"
|
||||||
|
|
||||||
if [ ! -z "$code" ] && [ ! "$code" == '202' ] ; then
|
if [ ! -z "$code" ] && [ ! "$code" == '202' ] ; then
|
||||||
_err "challenge error: $d"
|
_err "$d:Challenge error: $resource"
|
||||||
_stopserver $serverproc
|
_stopserver $serverproc
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
@ -426,7 +427,7 @@ issue() {
|
|||||||
_debug "checking"
|
_debug "checking"
|
||||||
|
|
||||||
if ! _get $uri ; then
|
if ! _get $uri ; then
|
||||||
_err "Verify error:$resource"
|
_err "$d:Verify error:$resource"
|
||||||
_stopserver $serverproc
|
_stopserver $serverproc
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
@ -439,7 +440,7 @@ issue() {
|
|||||||
|
|
||||||
if [ "$status" == "invalid" ] ; then
|
if [ "$status" == "invalid" ] ; then
|
||||||
error=$(echo $response | egrep -o '"error":{[^}]*}' | grep -o '"detail":"[^"]*"' | cut -d '"' -f 4)
|
error=$(echo $response | egrep -o '"error":{[^}]*}' | grep -o '"detail":"[^"]*"' | cut -d '"' -f 4)
|
||||||
_err "Verify error:$error"
|
_err "$d:Verify error:$error"
|
||||||
_stopserver $serverproc
|
_stopserver $serverproc
|
||||||
return 1;
|
return 1;
|
||||||
fi
|
fi
|
||||||
@ -447,7 +448,7 @@ issue() {
|
|||||||
if [ "$status" == "pending" ] ; then
|
if [ "$status" == "pending" ] ; then
|
||||||
_info "Pending"
|
_info "Pending"
|
||||||
else
|
else
|
||||||
_err "Verify error:$response"
|
_err "$d:Verify error:$response"
|
||||||
_stopserver $serverproc
|
_stopserver $serverproc
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
@ -485,7 +486,7 @@ issue() {
|
|||||||
|
|
||||||
if [ -z "$Le_LinkCert" ] ; then
|
if [ -z "$Le_LinkCert" ] ; then
|
||||||
response="$(echo $response | base64 -d)"
|
response="$(echo $response | base64 -d)"
|
||||||
_info "Sign failed: $(echo "$response" | grep -o '"detail":"[^"]*"')"
|
_err "Sign failed: $(echo "$response" | grep -o '"detail":"[^"]*"')"
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -633,12 +634,17 @@ install() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
_info "Installing cron job"
|
_info "Installing cron job"
|
||||||
|
if command -v sudo > /dev/null ; then
|
||||||
|
if [ "$(sudo -n uptime 2>&1|grep "load"|wc -l)" != "0" ] ; then
|
||||||
|
SUDO=sudo
|
||||||
|
fi
|
||||||
|
fi
|
||||||
if ! crontab -l | grep 'le.sh renewAll' ; then
|
if ! crontab -l | grep 'le.sh renewAll' ; then
|
||||||
crontab -l | { cat; echo "0 0 * * * le.sh renewAll"; } | crontab -
|
crontab -l | { cat; echo "0 0 * * * $SUDO le renewAll > /dev/null"; } | crontab -
|
||||||
if command -v crond > /dev/null ; then
|
if command -v crond > /dev/null ; then
|
||||||
service crond reload 2>/dev/null
|
service crond reload >/dev/null
|
||||||
else
|
else
|
||||||
service cron reload 2>/dev/null
|
service cron reload >/dev/null
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user