File: util.go

package info (click to toggle)
golang-github-okzk-sdnotify 0.0~git20180710.d9becc3-4
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 84 kB
  • sloc: makefile: 3
file content (39 lines) | stat: -rw-r--r-- 906 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
package sdnotify

import (
	"errors"
	"fmt"
)

// ErrSdNotifyNoSocket is the error returned when the NOTIFY_SOCKET does not exist.
var ErrSdNotifyNoSocket = errors.New("No socket")

// Ready sends READY=1 to the systemd notify socket.
func Ready() error {
	return SdNotify("READY=1")
}

// Stopping sends STOPPING=1 to the systemd notify socket.
func Stopping() error {
	return SdNotify("STOPPING=1")
}

// Reloading sends RELOADING=1 to the systemd notify socket.
func Reloading() error {
	return SdNotify("RELOADING=1")
}

// Errno sends ERRNO=? to the systemd notify socket.
func Errno(errno int) error {
	return SdNotify(fmt.Sprintf("ERRNO=%d", errno))
}

// Status sends STATUS=? to the systemd notify socket.
func Status(status string) error {
	return SdNotify("STATUS=" + status)
}

// Watchdog sends WATCHDOG=1 to the systemd notify socket.
func Watchdog() error {
	return SdNotify("WATCHDOG=1")
}