mirror of
https://github.com/edgebox-iot/edgeboxctl.git
synced 2026-11-13 03:49:47 +01:00
Structure
This commit is contained in:
@@ -0,0 +1,7 @@
|
|||||||
|
package diagnostics
|
||||||
|
|
||||||
|
var Version string
|
||||||
|
|
||||||
|
var Commit string
|
||||||
|
|
||||||
|
var BuildDate string
|
||||||
@@ -7,16 +7,24 @@ import (
|
|||||||
"os/signal"
|
"os/signal"
|
||||||
"time"
|
"time"
|
||||||
//"syscall"
|
//"syscall"
|
||||||
|
"github.com/edgebox-iot/sysctl/internal/diagnostics"
|
||||||
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
|
||||||
// load command line arguments
|
// load command line arguments
|
||||||
|
|
||||||
|
version := flag.Bool("version", false, "Get the version info")
|
||||||
name := flag.String("name", "edgebox", "name for the service")
|
name := flag.String("name", "edgebox", "name for the service")
|
||||||
|
|
||||||
flag.Parse()
|
flag.Parse()
|
||||||
|
|
||||||
|
if *version {
|
||||||
|
printVersion()
|
||||||
|
os.Exit(0)
|
||||||
|
}
|
||||||
|
|
||||||
log.Printf("Starting Sysctl service for %s", *name)
|
log.Printf("Starting Sysctl service for %s", *name)
|
||||||
|
|
||||||
// setup signal catching
|
// setup signal catching
|
||||||
@@ -32,7 +40,7 @@ func main() {
|
|||||||
go func() {
|
go func() {
|
||||||
s := <-sigs
|
s := <-sigs
|
||||||
log.Printf("RECEIVED SIGNAL: %s", s)
|
log.Printf("RECEIVED SIGNAL: %s", s)
|
||||||
AppCleanup()
|
appCleanup()
|
||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
}()
|
}()
|
||||||
|
|
||||||
@@ -50,6 +58,13 @@ func main() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// AppCleanup : cleanup app state before exit
|
// AppCleanup : cleanup app state before exit
|
||||||
func AppCleanup() {
|
func appCleanup() {
|
||||||
log.Println("Cleaning up app status before exit")
|
log.Println("Cleaning up app status before exit")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func printVersion() {
|
||||||
|
log.Printf(
|
||||||
|
"version: %s\ncommit: %s\nbuild time: %s",
|
||||||
|
diagnostics.Version, diagnostics.Commit, diagnostics.BuildDate,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user