So... the last couple days I've been poking around with the headless server.
And I thought it would be nice to start brewing up some utilities for a web interface.
I've got some scripts to monitor the status of a headless server and present the results as a page, and a couple scripts to help parse game log events, (like players joining and leaving). Has anyone else been working on similar things?
Headless server util scripts.[Linux]
-
- Filter Inserter
- Posts: 478
- Joined: Fri Jul 17, 2015 6:56 pm
- Contact:
Re: Headless server util scripts.[Linux]
Been trying to motivate myself to make some but everytime I open the log file to start working on parsing it I'm just like nope. Good to see someone is working on it though so us lazy people can continue what we do best lol. If you need someone to help bugtest your scripts or just feedback upload them and I'll run them on my server and take a look.
EDIT: Forgot to ask what language you're scripts are in.
EDIT: Forgot to ask what language you're scripts are in.
Looking for a multiplayer server? Check out my servers Vanilla Server
Re: Headless server util scripts.[Linux]
I just uploaded my init script (bash) if this could be useful? (but I guess you already have something like this seeing you mentioned you already monitor the status)
https://forums.factorio.com/forum/vie ... 53&t=13874
https://forums.factorio.com/forum/vie ... 53&t=13874
Hosting a factorio server? Take a look at this || init script ||.
Re: Headless server util scripts.[Linux]
I'll be honest, my scripts aren't quite as nice as those, in terms of features.
I'm looking at trying to parse the autosave files sometime(you know, to report status), but they're a tough nut to crack.
My status page is pretty bare bones, but useful for basic monitoring: http://ikanreed.net/py/factoriostatus.py
http://ikanreed.net/factorio/factoriostatus.py and here's the code for it.
And here's the program that handles the output to generate the /players file. You have to manually pipe the server output to it for it to do so.
I'm looking at trying to parse the autosave files sometime(you know, to report status), but they're a tough nut to crack.
My status page is pretty bare bones, but useful for basic monitoring: http://ikanreed.net/py/factoriostatus.py
http://ikanreed.net/factorio/factoriostatus.py and here's the code for it.
And here's the program that handles the output to generate the /players file. You have to manually pipe the server output to it for it to do so.
Re: Headless server util scripts.[Linux]
You can use pgrep facserver instead of ps aux | grep facserver. Advantage in using pgrep instead of ps and grep is that pgrep won't list itself in the output. Which means you can simply check its return status instead of checking the actual text output – useful in scripts in general, not just here.
Re: Headless server util scripts.[Linux]
I've put some thought into determining which process of the server is actually running (you can have multiple factorio installs all running on the same physical/virtual server).
If only looking for "fac" you could potentially find processes named "faculty/facility/minecraft-factory"
Have a look at the find_pid() function in my scrip, currently on line 108
I'm using the invocation (defined on line 79) used to start the binary, hoping this is uniq enough to ensure my pid-finding does not pick up any random pids besides the actual server pid. Good luck =)
It's either implementing soemthing similar in your py script or perhaps leave the init script as it is and call "/etc/init.d/factorio status" from your script, if the server is indeed running that will return 0, if it is not it will return 1 per shell scripting convention.
If only looking for "fac" you could potentially find processes named "faculty/facility/minecraft-factory"
Have a look at the find_pid() function in my scrip, currently on line 108
I'm using the invocation (defined on line 79) used to start the binary, hoping this is uniq enough to ensure my pid-finding does not pick up any random pids besides the actual server pid. Good luck =)
It's either implementing soemthing similar in your py script or perhaps leave the init script as it is and call "/etc/init.d/factorio status" from your script, if the server is indeed running that will return 0, if it is not it will return 1 per shell scripting convention.
Hosting a factorio server? Take a look at this || init script ||.