You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

57 lines
1011 B

9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
  1. #!/usr/bin/env sh
  2. #Here is a sample custom api script.
  3. #This file name is "dns_myapi.sh"
  4. #So, here must be a method dns_myapi_add()
  5. #Which will be called by acme.sh to add the txt record to your api system.
  6. #returns 0 means success, otherwise error.
  7. ######## Public functions #####################
  8. #Usage: dns_myapi_add _acme-challenge.www.domain.com "XKrxpRBosdIKFzxW_CT3KLZNf6q0HG9i01zxXp5CPBs"
  9. dns_myapi_add() {
  10. fulldomain=$1
  11. txtvalue=$2
  12. _err "Not implemented!"
  13. return 1;
  14. }
  15. #Usage: dns_myapi_del _acme-challenge.www.domain.com
  16. dns_myapi_del(){
  17. _err "Not implemented!"
  18. return 1
  19. }
  20. #################### Private functions bellow ##################################
  21. _info() {
  22. if [ -z "$2" ] ; then
  23. echo "[$(date)] $1"
  24. else
  25. echo "[$(date)] $1='$2'"
  26. fi
  27. }
  28. _err() {
  29. _info "$@" >&2
  30. return 1
  31. }
  32. _debug() {
  33. if [ -z "$DEBUG" ] ; then
  34. return
  35. fi
  36. _err "$@"
  37. return 0
  38. }
  39. _debug2() {
  40. if [ "$DEBUG" ] && [ "$DEBUG" -ge "2" ] ; then
  41. _debug "$@"
  42. fi
  43. return
  44. }