Debian Codegraph @

dependencies/pkg/mod/github.com/okzk/[email protected]/util.go

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