forked from TrueCloudLab/rclone
vendor: add github.com/okzk/sdnotify
This commit is contained in:
parent
6cc968b085
commit
0bfa29cbcf
9 changed files with 156 additions and 1 deletions
22
vendor/github.com/okzk/sdnotify/notify_linux.go
generated
vendored
Normal file
22
vendor/github.com/okzk/sdnotify/notify_linux.go
generated
vendored
Normal file
|
@ -0,0 +1,22 @@
|
|||
package sdnotify
|
||||
|
||||
import (
|
||||
"net"
|
||||
"os"
|
||||
)
|
||||
|
||||
func SdNotify(state string) error {
|
||||
name := os.Getenv("NOTIFY_SOCKET")
|
||||
if name == "" {
|
||||
return SdNotifyNoSocket
|
||||
}
|
||||
|
||||
conn, err := net.DialUnix("unixgram", nil, &net.UnixAddr{Name: name, Net: "unixgram"})
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer conn.Close()
|
||||
|
||||
_, err = conn.Write([]byte(state))
|
||||
return err
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue