mirror of
https://github.com/acmesh-official/acme.sh.git
synced 2025-04-29 22:32:44 +00:00
Merge c327b888c12904c76a4c504f341e32f07a33b973 into 9b267bb5725eca0b2b8f34682aca89f5d3fbcb5e
This commit is contained in:
commit
5fec9a2be3
37
notify/customscript.sh
Normal file
37
notify/customscript.sh
Normal file
@ -0,0 +1,37 @@
|
||||
#!/usr/bin/env sh
|
||||
|
||||
# Support custom notification script
|
||||
|
||||
# CUSTOMSCRIPT_PATH="/usr/local/bin/acme-notification.sh"
|
||||
|
||||
customscript_send() {
|
||||
_subject="$1"
|
||||
_content="$2"
|
||||
_statusCode="$3" #0: success, 1: error 2($RENEW_SKIP): skipped
|
||||
_debug "_subject" "$_subject"
|
||||
_debug "_content" "$_content"
|
||||
_debug "_statusCode" "$_statusCode"
|
||||
|
||||
CUSTOMSCRIPT_PATH="${CUSTOMSCRIPT_PATH:-$(_readaccountconf_mutable CUSTOMSCRIPT_PATH)}"
|
||||
if [ -n "$CUSTOMSCRIPT_PATH" ] && ! _exists "$CUSTOMSCRIPT_PATH"; then
|
||||
_err "It seems that the command $CUSTOMSCRIPT_PATH is not in path."
|
||||
return 1
|
||||
fi
|
||||
|
||||
if [ -n "$CUSTOMSCRIPT_PATH" ]; then
|
||||
_saveaccountconf_mutable CUSTOMSCRIPT_PATH "$CUSTOMSCRIPT_PATH"
|
||||
else
|
||||
_clearaccountconf "CUSTOMSCRIPT_PATH"
|
||||
fi
|
||||
|
||||
result=$(eval "'$CUSTOMSCRIPT_PATH' '$_subject' '$_content' '$_statusCode'" 2>&1)
|
||||
|
||||
if [ $? -ne 0 ]; then
|
||||
_debug "custom script execution error."
|
||||
_err "$result"
|
||||
return 1
|
||||
fi
|
||||
|
||||
_debug "custom script executed successfully."
|
||||
return 0
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user