Skip to content

victorenator/go-sd

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 

Repository files navigation

go-sd

Go library for systemd

Socket Activation

import "github.com/victorenator/go-sd"

func main() {
    fds, _ := sd.Listeners()
    for i, fd := range fds {
        fmt.Printf("%d; Name: %s\n", i, fd.Name())
        l, _ := fd.Listener()
        if i < len(fds) - 1 {
            go func() {
                http.Serve(l, nil)
            }()
        } else {
            http.Serve(l, nil)
        }
    }
}

Type=notify

import "github.com/victorenator/go-sd"

func main() {
    sd.Notify("STATUS=Starting ...\n")
    time.Sleep(10 * time.Second)
    sd.Notify("READY=1\nSTATUS=Ready to process ...\n")
    http.ListenAndServe(":8088", nil)
}

About

Go library for systemd

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages