mirror of
https://github.com/Evidlo/remarkable_printer.git
synced 2024-10-20 03:27:37 -04:00
if socket-activated, exit after printing
This commit is contained in:
parent
1edb189aba
commit
ba1798ce46
7
main.go
7
main.go
|
@ -69,7 +69,8 @@ func main() {
|
|||
|
||||
var l net.Listener
|
||||
var err error
|
||||
if os.Getenv("LISTEN_PID") == strconv.Itoa(os.Getpid()) {
|
||||
var isSocketActivated = os.Getenv("LISTEN_PID") == strconv.Itoa(os.Getpid())
|
||||
if isSocketActivated {
|
||||
l, err = net.FileListener(os.NewFile(3, "systemd-socket"))
|
||||
} else {
|
||||
l, err = net.Listen("tcp", *CONN_HOST+":"+*CONN_PORT)
|
||||
|
@ -102,6 +103,10 @@ func main() {
|
|||
}
|
||||
}
|
||||
|
||||
if isSocketActivated {
|
||||
break
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue