openkeepd/cmd/openkeepd/main.go

32 lines
590 B
Go

package main
import (
"os"
"os/signal"
"syscall"
"github.com/sirupsen/logrus"
)
var logger = logrus.New()
func main() {
logger.Info("Starting openkeepd server...")
logger.Info("Server successfully started!")
// CTRL+C handler.
signalHandler := make(chan os.Signal, 1)
shutdownDone := make(chan bool, 1)
signal.Notify(signalHandler, os.Interrupt, syscall.SIGTERM)
go func() {
<-signalHandler
logger.Info("CTRL+C or SIGTERM received, shutting down openkeepd...")
shutdownDone <- true
}()
<-shutdownDone
logger.Info("Server successfully shutted down")
os.Exit(0)
}