User panel stuff on forum
  8 posts on 1 page  1
Server Talk
2019-05-29, 11:11
Member
3 posts

Registered:
May 2019
Noob here,
Read through all the docs and have a nquake server running on a Linux VPS with one game server.
Everything works fine, Can connect, play, etc.

What I would like to do now is get a bash script to be executed every time a match has ended / server loads a new map.
The idea is that the script pings a telegram bot I have made and sends end of match details to all of the bot's subscribers.
The script works fine I'm i manually execute it server side, however I am having a hard time trying to figure out how to get it to run when a match ends.

I've tried to exec the script from the server.cfg & reset.cfg scripts that sit in the ktx folder serverside.
However I am unsure if:
A) You can even exec a bash script from a .cfg file
B) That the server.cfg & reset.cfg files are called when the server is re-loaded on match end

Sorry if this is the wrong place to post this, any insight is appreciated!
2019-05-29, 16:45
Administrator
2059 posts

Registered:
Jan 2006
Bash scripts from configs is not possible i think.

Maybe you could try to monitor whenever there's a new demo saved in ktx/demos folder instead?
www.facebook.com/QuakeWorld
2019-05-29, 21:08
Member
805 posts

Registered:
Mar 2006
Use the bash script to monitor the log file! I used that to compile custom messages for Urban Terror (a Q3 mod)!

edit.: python is probably a better choice
https://tinyurl.com/qwbrasil - QuakeFiles
2019-05-31, 10:16
Member
3 posts

Registered:
May 2019
Thanks both, Didn't even cross my mind to try either of those ideas!

Will let you know how it goes.
2019-05-31, 11:04
Administrator
2059 posts

Registered:
Jan 2006
Might be worth checking out sv_demotxt in mvdsv.cfg too, enabling it will generate a text file with match info in it that you could parse for more info.

sv_demotxt 1 = generate .txt
sv_demotxt 2 = generate .json
www.facebook.com/QuakeWorld
2019-05-31, 12:21
Administrator
284 posts

Registered:
Sep 2015
Also look at sv_onrecordfinish, which I think was originally intended to create a .zip out of the .mvd/.txt files but could probably be used to parse the .txt file and send results somewhere.
2019-06-05, 11:11
News Writer
66 posts

Registered:
Sep 2013
On top of all these, maybe get in touch with the current maintainer of mvdsv and/or create a feature request.
This idea sound like a quite useful one, so why not create a built-in support for this.
2019-06-12, 12:16
Member
3 posts

Registered:
May 2019
Thanks for the help all, got it working now thanks to you guys.

In the end I went with a cron job that runs every minute, that runs a bash script to check for new entries in the demo folder.
If there is a new entry, it parses the new demo json file for what I need and sends a new file to a hosted bucket and pings my telegram bot.
My bot then retrives the file, reads it and empties its contents back to me in-app.
It's not the most elegant solution I admit, but it satisfies what I set out to do.

Right now i've just got it reporting match results from my server when they finish, but am expanding so it sends match results to any of the bot subscibers.

If anyone is intrested i'll probably make the repo public on github once its finished.
  8 posts on 1 page  1