diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..5096d4f --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,3 @@ +## 0.1.1 +This minor release fixes some problems with parameter passing on windows. +On how to apply the changes, read the example config.json. \ No newline at end of file diff --git a/README.md b/README.md index a75afa3..1bc0bd5 100644 --- a/README.md +++ b/README.md @@ -76,107 +76,124 @@ If you encounter any issues with GoRcon-ArmA and need help, we recommend to firs ``` ./gorcon-arma_linux-amd64 --logtostderr=true -v=2``` The Verbosity Level is categorized in the following order: -``` -1: Usual Output (can be always on) -2: More Info -3: Debug Communication -4: Debug Internals -5: Intense Debug -10: Loop Debugging -``` + +- ```1``` Usual Output (can be always on) +- ```2``` More Info +- ```3``` Debug Communication +- ```4``` Debug Internals +- ```5``` Intense Debug +- ```10``` Loop Debugging To give us feedback on your problems or to tell us about requests/ideas feel free to post them in our Issues Section on [Gitlab](https://git.play-net.org/playnet-public/gorcon-arma/issues) or [Github](https://github.com/playnet-public/gorcon-arma/issues) We also happily invite you to join us on [Slack](https://playnet-ihtjamcsba.now.sh/) or [Discord](https://discord.gg/dWZkR6R)! ### Config Manual + ```json { "arma": { - // Whether or not RCon is enabled "enabled": true, - // IP of the RCon Server "ip": "127.0.0.1", - // RCon Port as set in beserver.cfg "port": "2301", - // RCon Password as set in beserver.cfg "password": "qwerty", - // The amount of seconds to wait until a keepAlivePacket is send to RCon (BattlEye Specification is min. 45sec) "keepAliveTimer": 10, - // The maximum tolerance between the sent keepAlives and the server response (higher means slower detection of disconnect, lower might cause unrequired reconnects) "keepAliveTolerance": 4, - // Whether or not the Server Chat should be streamed to the console/stdout "showChat": true, - // Whether or not the Server Events should be streamed to the console/stdout "showEvents": true }, "scheduler": { - // Wheteher or not the scheduler is enabled "enabled": true, - // Path to schedule.json (keep local if not required otherwise) "path": "schedule.json" }, "watcher": { - // Wheteher or not the watcher is enabled "enabled": true, - // Path to the ArmA executable (linux or windows) "path": "D:/Program Files (x86)/Steam/SteamApps/common/Arma 3/arma3server.exe", - // single string of parameters for ArmA (watch formating for linux) - "params": "-name=goTest", - // Enable or Disable stderr/stdout logging of game server (linux systems only) + "params": [ + "-name=goTest", + "-port-2303" + ], "logToFile": true, - // Set the folder path in which logfiles are being created "logFolder": "logs", - // Enables streaming of the server output(logs) to the console (linux systems only) "logToConsole": false } } ``` +**Explanation for ```arma``` section** +- ```enabled``` Whether or not RCon is enabled +- ```ip``` IP of the RCon Server +- ```port``` RCon Port as set in _beserver.cfg_ +- ```password``` RCon Password as set in _beserver.cfg_ +- ```keepAliveTimer``` The amount of seconds to wait until a keepAlivePacket is send to RCon (BattlEye Specification is min. 45sec) +- ```keepAliveTolerance``` The maximum tolerance between the sent keepAlives and the server response (higher means slower detection of disconnect, lower might cause unrequired reconnects) +- ```showChat``` Whether or not the Server Chat should be streamed to the console/stdout +- ```showEvents```Whether or not the Server Events should be streamed to the console/stdout + +**Explanation for ```scheduler``` section** +- ```enabled``` Wheteher or not the scheduler is enabled +- ```path``` Path to schedule.json (keep local if not required otherwise) + +**Explanation for ```watcher``` section** +- ```enabled``` Wheteher or not the watcher is enabled +- ```path``` Path to the ArmA executable (linux or windows) +- ```params``` Array of parameters for ArmA (watch formating for linux) +- ```logToFile``` Enable or Disable stderr/stdout logging of game server (linux systems only) +- ```logFolder``` Set the folder path in which logfiles are being created +- ```logToConsole``` Enables streaming of the server output(logs) to the console (linux systems only) + ### Schedule Manual The Scheduler implements a system like cronjobs. To learn more about it check out this [link](https://crontab.guru) + ```json { "schedule": [ - //One Schedule Event { - // Command to be executed (if not restart) - "command": "say -1 Restart in 30 minutes", - // If the Server should be restarted (overrides command) + "command": "say -1 Message every 5 minutes", "restart": false, - // Day of the Week to run the Event (0-6, 0 = Sunnday, * = Every Day) "day": "*", - // Hour of the Day to run the Event (0-23, * = Every Hour) "hour": "*", - // Minute of the Hour to run the Event (0-60, * = Every Minute) - "minute": "11" - }, - - // Example Event to restart the Server every day at 12:08am - { - "command": "", - "restart": true, - "day": "*", - "hour": "12", - "minute": "8" - }, - - // Example Event to restart the Server every hour at xx:30am/pm - { - "command": "", - "restart": true, - "day": "*", - "hour": "*", - "minute": "30" + "minute": "*/5" } ] } ``` +- ```command``` Command to be executed (if not restart) +- ```restart``` If the Server should be restarted (overrides command) +- ```day``` Day of the Week to run the Event (0-6, 0 = Sunnday, * = Every Day) +- ```hour``` Hour of the Day to run the Event (0-23, * = Every Hour) +- ```minute``` Minute of the Hour to run the Event (0-60, * = Every Minute) + +### Scheduler Examples + +Example Event to restart the Server every hour at xx:30am/pm + +```json +{ + "command": "", + "restart": true, + "day": "*", + "hour": "*", + "minute": "30" +} +``` + +Example Event to restart the Server every day at 12:08am + +```json +{ + "command": "", + "restart": true, + "day": "*", + "hour": "12", + "minute": "8" +} +``` ## License This project is licensed under the included License (GNU GPLv3). We also ask you to keep the projects name and links as they are, to direct possible contributors and users to the original sources. Do not host releases yourself. Always redirect users back to the official releases for downloads. -Powered by https://play-net.org. +Powered by https://play-net.org. \ No newline at end of file diff --git a/config.json b/config.json index 6ef4e2f..8737482 100644 --- a/config.json +++ b/config.json @@ -16,7 +16,10 @@ "watcher": { "enabled": true, "path": "D:/Program Files (x86)/Steam/SteamApps/common/Arma 3/arma3server.exe", - "params": "-name=goTest", + "params": [ + "-name=goTest", + "-port-2303" + ], "logToFile": true, "logFolder": "logs", "logToConsole": false diff --git a/gorcon-arma/gorcon-arma.go b/gorcon-arma/gorcon-arma.go index 57311e8..55e79b5 100644 --- a/gorcon-arma/gorcon-arma.go +++ b/gorcon-arma/gorcon-arma.go @@ -119,7 +119,7 @@ func do() error { func runWatcher(useSched, useWatch bool) (watcher *procwatch.Watcher, err error) { var armaPath string - var armaParam string + var armaParam []string var schedulerEntity *procwatch.Schedule if useSched { @@ -138,7 +138,7 @@ func runWatcher(useSched, useWatch bool) (watcher *procwatch.Watcher, err error) if useWatch { armaPath = cfg.GetString("watcher.path") - armaParam = cfg.GetString("watcher.params") + armaParam = cfg.GetStringSlice("watcher.params") fmt.Println("\nWatcher is enabled") fmt.Printf("\nWatcher Config: \n"+ "Path to ArmA Executable: %v \n"+ diff --git a/procwatch/watcher.go b/procwatch/watcher.go index c8f08cd..5d94017 100644 --- a/procwatch/watcher.go +++ b/procwatch/watcher.go @@ -14,7 +14,7 @@ import ( //Cfg contains all data required by Procwatch type Cfg struct { A3exe string - A3par string + A3par []string Schedule Schedule UseScheduler bool UseWatcher bool @@ -34,7 +34,7 @@ func (c Cfg) GetConfig() Cfg { //Watcher is the the Object Handling the Procwatch type Watcher struct { a3exe string - a3par string + a3par []string pid uint32 waitGroup sync.WaitGroup cmd *exec.Cmd @@ -67,7 +67,7 @@ func (w *Watcher) Start() { var err error if w.useWatcher { glog.V(2).Infoln("Starting Watcher") - w.cmd = exec.Command(w.a3exe, w.a3par) + w.cmd = exec.Command(w.a3exe, w.a3par...) w.cmd.Dir = path.Dir(w.a3exe) glog.V(2).Infof("Executing ArmA Executable: %v", w.cmd) w.stdout, err = w.cmd.StdoutPipe()