Added path checks and updated config
- Cleaned up func main() - Separated config into two sections server and factoryman - Updated backup.go to reflect changes to config file - Updated config.go to reflect changes to config.yml as well as added a check to paths in config.yml - Updated launch.go to reflect changes to config move cli handler from main to cli.go
This commit is contained in:
@@ -10,10 +10,10 @@ import (
|
||||
func startStopServer(cmd string, con GoConfig) {
|
||||
switch cmd {
|
||||
case "start":
|
||||
x := fmt.Sprintf("%s --port %d --server-settings %s --start-server %s", con.Config.ServExec, con.Config.ServPort, con.Config.ServCfg, con.Config.WorldFile)
|
||||
if con.Config.UseScreen { // if screen enabled in confing.yml
|
||||
x := fmt.Sprintf("%s --port %d --server-settings %s --start-server %s", con.Server.ServExec, con.Factoryman.ServPort, con.Server.ServCfg, con.Server.WorldFile)
|
||||
if con.Factoryman.UseScreen { // if screen enabled in confing.yml
|
||||
fmt.Println("Starting factorio server in screen session")
|
||||
startScreenCmd := exec.Command("screen", "-dmS", con.Config.ScreenName, "bash", "-c", x, "; exec sh")
|
||||
startScreenCmd := exec.Command("screen", "-dmS", con.Factoryman.ScreenName, "bash", "-c", x, "; exec sh")
|
||||
startScreenCmd.Stdout = os.Stdout
|
||||
startScreenCmd.Stderr = os.Stderr
|
||||
err := startScreenCmd.Run()
|
||||
@@ -31,7 +31,7 @@ func startStopServer(cmd string, con GoConfig) {
|
||||
}
|
||||
}
|
||||
case "stop":
|
||||
quitServerCmd := exec.Command("screen", "-S", con.Config.ScreenName, "-p", "0", "-X", "stuff", "/quit\n")
|
||||
quitServerCmd := exec.Command("screen", "-S", con.Factoryman.ScreenName, "-p", "0", "-X", "stuff", "/quit\n")
|
||||
err := quitServerCmd.Run()
|
||||
if err != nil {
|
||||
log.Fatalf("Command failed: %s, Error: %v", quitServerCmd.Args, err)
|
||||
|
||||
Reference in New Issue
Block a user