Skip to content

Commit b00ab1e

Browse files
committed
Add daemon mode (simulation)
1 parent ef76b11 commit b00ab1e

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

main.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import (
55
"log"
66
"os"
77
"strconv"
8+
"time"
89

910
"github.com/darkfronza/alien-invasion/simulation"
1011
"github.com/darkfronza/alien-invasion/worldmap"
@@ -14,6 +15,12 @@ var Version string
1415

1516
func main() {
1617
// TODO: add daemon feature to test systemd on nix
18+
if len(os.Args) == 2 && os.Args[1] == "daemon" {
19+
fmt.Printf("daemon mode..... version=%s\n", Version)
20+
time.Sleep(30 * time.Minute)
21+
os.Exit(0)
22+
}
23+
1724
if len(os.Args) == 2 && (os.Args[1] == "-v" || os.Args[1] == "version") {
1825
fmt.Printf("alien-invasion simulator %s\n", Version)
1926
os.Exit(0)

0 commit comments

Comments
 (0)