Most of what I had to say took place on IRC, so it will be better if I post that conversation here as both sides are presented in it:
<Cyber_Rock> I want to write the output of htop on a file and parse it using awk. Then I want to integrate it in the script of starting the headless server which will automaticall stop the headless process (which will be workin on background) if/when a certain amount of load/memory/MHz/MB is reached
<Cyber_Rock> that would serve the purpose of relieving me from the worry that if the headless is left unattended then it will probably crash
<Cyber_Rock> currently, not many are using resource taxing application - I am the only one doing that
<Cyber_Rock> but if there ever comes a time when that happens then I want to be sure that I will not be the cause for the crash
<Cyber_Rock> the idea is a simple one, which might even help someone like me who is hosting a headless
<Cyber_Rock> and it is not that difficult to implement if someone know scripting
<Cyber_Rock> write the data of htop to a file. read the file. use condition which states when to kill the process. if not then let it run. repeat after a set period of time
This is because my Server lacks resources (especially a good CPU).
The first time I tested it with tom, my CPU peaked at 92% for few seconds. I don't about others but that bit of information scares me ( I am not the owner of the server) considering that the CPU is ~2 GHz. I, however, did not have any issue with the RAM.
But because of this incident I thought of the above script.
This is the response I got from tom:
<tomreyn> the most likely situation this script will trigger is when a game is going and CPU starts to attack. killing a headless server based on arbitrary factors isn't a good idea, since it breaks a game in the middle. which kills the fun.
<tomreyn> i think what you could do is post a feature request to have a player limit
<tomreyn> fewer players should result in fewer resource consumption
<tomreyn> i aslo suggested to run the soon to be available pre-release, since it should consume less resources than 3.7.1 based on initial tests.
<tomreyn> i know scripting, but will not help to write scripts which kill the server process during ongoing games, since this spoils the fun for the players, basically means the server is not worth playing on, and is, in my opinion, the wrong approach
<tomreyn> (and that's why i made those alternative suggestions.)
I thought this when I heard that, these are my ideas to overcome those difficulties:
<Cyber_Rock> the matter of concern is not the lag but is the cpu usage
<Cyber_Rock> it might be caused when the host's bot makes descision ( or not )
<Cyber_Rock> so, a script limiting the number of bots would be a better idea than limiting the players altogether
<Cyber_Rock> or am I wrong?
<Cyber_Rock> the script I suggested might be used as a contingency plan, if ever the resources get too high, not only the ones used by the headless but all of the resources used by the VPS
<Cyber_Rock> another thing would be limiting the resources alloted for the game
<Cyber_Rock> like... well, I don't have any example, but you can understand
<Cyber_Rock> the thing is that I want to run the headless permanently without ever worrying about the resources it would use. whether it will or won't cause crash
<Cyber_Rock> because the server is not located near us. It will require a admin who is available there to make things right.
<Cyber_Rock> to be frank, few bots and few sites are also linked to it. so the crash would not only cause problem to me but also to everyone using the server
That about sums it up.
Thanks in advance as the solution to this problem would surely help me