Fixed some minor issues with backup func added stdout to backup functions added stdout to launchserver functions changed tar execs to add verbos for stdout
47 lines
1.2 KiB
Go
47 lines
1.2 KiB
Go
package main
|
|
|
|
import (
|
|
"fmt"
|
|
"os"
|
|
)
|
|
|
|
var c = readCfg(fmConfig)
|
|
|
|
func main() {
|
|
if len(os.Args) == 1 {
|
|
fmt.Println("Use 'start', 'stop', or 'backup' command")
|
|
fmt.Println("ex. factoryman start")
|
|
fmt.Println("To configure edit 'conifg.yml'")
|
|
} else if len(os.Args) > 1 {
|
|
switch os.Args[1] {
|
|
case "start":
|
|
startStopServer("start", c)
|
|
case "stop":
|
|
startStopServer("stop", c)
|
|
case "help", "h", "--help", "-h":
|
|
fmt.Printf("Start Server: %s start\nStop Server: %s stop\n", os.Args[0], os.Args[0])
|
|
fmt.Printf("Run backup\n\tFull backup: %s backup full", os.Args[0])
|
|
fmt.Printf("\n\tBackup saves: %s backup saves\n", os.Args[0])
|
|
case "backup":
|
|
if len(os.Args) > 2 {
|
|
switch os.Args[2] {
|
|
case "full":
|
|
backUp("full", c)
|
|
case "saves":
|
|
backUp("saves", c)
|
|
default:
|
|
fmt.Println("Invalid backup type: use 'full' or 'saves'")
|
|
}
|
|
} else {
|
|
fmt.Println("Missing backup type: use 'full' or 'saves'")
|
|
}
|
|
default:
|
|
fmt.Printf("Unknown command: %s. Use 'start', 'stop', or 'backup'.\n", os.Args[1])
|
|
}
|
|
} else {
|
|
fmt.Println("Use 'start', 'stop', or 'backup' command")
|
|
fmt.Println("ex. factoryman start")
|
|
fmt.Println("To configure edit 'conifg.yml'")
|
|
}
|
|
}
|