summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2025-03-12 05:37:53 -0500
committerJeff Carr <[email protected]>2025-03-12 06:40:17 -0500
commitc2f796de1e07e59bb379fa4e0a222bc13dcfe571 (patch)
tree8409cc96c60af6710f1e27ff8dd3b7a8d330124a
parentc941ec541ee9edc81e99708d9c000d65f8d1d812 (diff)
daemon option works correctly
-rw-r--r--Makefile3
-rw-r--r--gus.service2
-rw-r--r--main.go21
3 files changed, 13 insertions, 13 deletions
diff --git a/Makefile b/Makefile
index ae508bb..cdec0f0 100644
--- a/Makefile
+++ b/Makefile
@@ -24,6 +24,9 @@ sudo: build
debian:
go-deb --repo go.wit.com/lib/daemons/gus
+daemon:
+ ./gus --daemon --no-gui --config /etc/gus/gus.text
+
goimports:
goimports -w *.go
diff --git a/gus.service b/gus.service
index eec34ff..8140f94 100644
--- a/gus.service
+++ b/gus.service
@@ -5,7 +5,7 @@ After=network.target
[Service]
User=root
Type=simple
-ExecStart=/usr/bin/zood --daemon
+ExecStart=/usr/bin/gus --daemon --no-gui
Restart=always
RestartSec=5s
KillMode=process
diff --git a/main.go b/main.go
index 889df91..65f6132 100644
--- a/main.go
+++ b/main.go
@@ -53,24 +53,24 @@ func main() {
if argv.Daemon {
// turn off timestamps for STDOUT (systemd adds them)
log.DaemonMode(true)
+ startGus()
startHTTP()
os.Exit(0)
}
if gui.NoGui() {
- all := me.portmaps.All()
- for all.Scan() {
- pm := all.Next()
- if !pm.Enabled {
- continue
- }
- log.Info("portmap enabled for port", pm.Localport, "to", pm.Dest)
- go gus3000(pm)
- }
+ startGus()
startHTTP()
os.Exit(0)
}
+ startGus()
+ // go NewWatchdog()
+ go startHTTP()
+ doGui()
+}
+
+func startGus() {
all := me.portmaps.All()
for all.Scan() {
pm := all.Next()
@@ -80,9 +80,6 @@ func main() {
log.Info("portmap enabled for port", pm.Localport, "to", pm.Dest)
go gus3000(pm)
}
- // go NewWatchdog()
- go startHTTP()
- doGui()
}
// func doME(pm *Portmap, gus listener.Accept) {