diff --git a/README.md b/README.md index 6d95ee4..d9e9971 100644 --- a/README.md +++ b/README.md @@ -4,6 +4,6 @@ This tool allows for the simple configuration, backup, and starting of a V Risin - [x] Backup Saves - [x] Update - [x] Upload Config Files -- [] Check if Server Runnning -- [] Start Server -- [] Stop Server \ No newline at end of file +- [x] Check if Server Runnning +- [x] Start Server +- [x] Stop Server \ No newline at end of file diff --git a/handlers.go b/handlers.go index 2bd7f34..52cf78f 100644 --- a/handlers.go +++ b/handlers.go @@ -15,6 +15,7 @@ import ( var server_sig = make(chan int, 1) var server_started = false +var server_process = exec.Command("xvfb-run", "-a", "wine", "/root/.wine/drive_c/vrisingserver/VRisingServer.exe") func check(err error) { if err != nil { @@ -39,7 +40,7 @@ func update(c *gin.Context) { if err != nil { c.String(http.StatusBadRequest, err.Error()) } else { - c.String(http.StatusOK, out.String()) + c.String(http.StatusOK, "Update Complete") } } @@ -125,11 +126,6 @@ func configure(c *gin.Context) { } func doIt() { - 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.Start() check(err) @@ -162,3 +158,11 @@ func stopServer(c *gin.Context) { c.String(http.StatusOK, "Already Stopped") } } + +func serverRunning(c *gin.Context) { + if server_started { + c.String(http.StatusOK, "true") + } else { + c.String(http.StatusOK, "false") + } +} diff --git a/html/index.html b/html/index.html index 6f9c002..946c61a 100644 --- a/html/index.html +++ b/html/index.html @@ -1,4 +1,5 @@ + Rod