Control for Server Process

This commit is contained in:
2022-05-25 12:44:09 -05:00
parent 2ac4037965
commit a8c5f0a1f0
2 changed files with 12 additions and 6 deletions

View File

@@ -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")
}