mirror of
https://github.com/rclone/rclone.git
synced 2025-12-21 10:43:37 +00:00
vendor: add github.com/okzk/sdnotify
This commit is contained in:
committed by
Nick Craig-Wood
parent
6cc968b085
commit
0bfa29cbcf
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
|
||||
}
|
||||
Reference in New Issue
Block a user