Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

util.go 906B

123456789101112131415161718192021222324252627282930313233343536373839
  1. package sdnotify
  2. import (
  3. "errors"
  4. "fmt"
  5. )
  6. // ErrSdNotifyNoSocket is the error returned when the NOTIFY_SOCKET does not exist.
  7. var ErrSdNotifyNoSocket = errors.New("No socket")
  8. // Ready sends READY=1 to the systemd notify socket.
  9. func Ready() error {
  10. return SdNotify("READY=1")
  11. }
  12. // Stopping sends STOPPING=1 to the systemd notify socket.
  13. func Stopping() error {
  14. return SdNotify("STOPPING=1")
  15. }
  16. // Reloading sends RELOADING=1 to the systemd notify socket.
  17. func Reloading() error {
  18. return SdNotify("RELOADING=1")
  19. }
  20. // Errno sends ERRNO=? to the systemd notify socket.
  21. func Errno(errno int) error {
  22. return SdNotify(fmt.Sprintf("ERRNO=%d", errno))
  23. }
  24. // Status sends STATUS=? to the systemd notify socket.
  25. func Status(status string) error {
  26. return SdNotify("STATUS=" + status)
  27. }
  28. // Watchdog sends WATCHDOG=1 to the systemd notify socket.
  29. func Watchdog() error {
  30. return SdNotify("WATCHDOG=1")
  31. }