diff --git a/build.sh b/build.sh new file mode 100755 index 0000000..38238b8 --- /dev/null +++ b/build.sh @@ -0,0 +1 @@ +go build . && docker cp vrisingd rvrising:/ \ No newline at end of file diff --git a/handlers.go b/handlers.go index a6ae4dd..2bd7f34 100644 --- a/handlers.go +++ b/handlers.go @@ -29,7 +29,7 @@ func index(c *gin.Context) { } func update(c *gin.Context) { - cmd := exec.Command("awdaawdawd") + cmd := exec.Command("wine", "/root/.wine/drive_c/steamcmd/steamcmd.exe", "+force_install_dir", `C:\VRisingServer`, "+login", "anonymous", "+app_update", "1829350", "+quit") var out bytes.Buffer cmd.Stdout = &out @@ -125,17 +125,23 @@ func configure(c *gin.Context) { } func doIt() { - server_process := exec.Command("pwd") + server_process := exec.Command("xvfb-run", "-a", "wine", "/root/.wine/drive_c/vrisingserver/VRisingServer.exe") var out bytes.Buffer server_process.Stdout = &out - err := server_process.Run() + err := server_process.Start() check(err) - print(out.String()) + println("Starting...") <-server_sig - server_process.Process.Signal(os.Kill) + + // Kill Process + pkill_process := exec.Command("pkill", "-SIGINT", "Xvfb") + pkill_process.Run() + server_process.Process.Wait() + + println("Stopped") } func startServer(c *gin.Context) { @@ -152,7 +158,6 @@ func stopServer(c *gin.Context) { if server_started { server_sig <- 1 server_started = false - c.String(http.StatusOK, "Process Stopped") } else { c.String(http.StatusOK, "Already Stopped") }