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.

52 lines
939 B

8 years ago
8 years ago
8 years ago
8 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. #fulldomain
  16. dns_myapi_rm() {
  17. fulldomain=$1
  18. }
  19. #################### Private functions bellow ##################################
  20. _info() {
  21. if [ -z "$2" ]; then
  22. echo "[$(date)] $1"
  23. else
  24. echo "[$(date)] $1='$2'"
  25. fi
  26. }
  27. _err() {
  28. _info "$@" >&2
  29. return 1
  30. }
  31. _debug() {
  32. if [ -z "$DEBUG" ]; then
  33. return
  34. fi
  35. _err "$@"
  36. return 0
  37. }
  38. _debug2() {
  39. if [ "$DEBUG" ] && [ "$DEBUG" -ge "2" ]; then
  40. _debug "$@"
  41. fi
  42. return
  43. }