Official Soldat Forums

Soldat Fans => Fan Apps => Topic started by: jrgp on August 12, 2010, 01:15:06 pm

Title: Python Soldat Dedicated Server Manager (beta)
Post by: jrgp on August 12, 2010, 01:15:06 pm
I've written a python script for Linux that keeps any number of Soldat dedicated servers alive and restarts them when/if they fail. (works by making sure the pid number in soldatserver.pid has a valid entry in /proc) It also has an optional socket admin interface that let's you connect and manage the defined servers.

When you connect you first enter your defined password, send a newline, then you have access to the following commands:
stop server id
start server id
status server id
startall
stopall
exit


Example session: (with password being 'meh')
joe@vm-joe-dev:~/pydaemon$ nc localhost 6969
meh
ok
status 1
off
start 1
ok
status 1
on
stop 1
ok
status 1
off
exit
joe@vm-joe-dev:~/pydaemon$



Instructions:
Download it, possibly rename to run.py, change the settings at the beginning of the file, either give it executable permissions and call it outright (eg: ./run.py) or just run it like python run.py.

Requirements:
Nothing special. Known to work with Python 2.6.2

Download it here: http://jrgp.u13.net/misc/pydaemon/run.py.txt

I'd appreciate any feedback anyone might have.
Title: Re: Python Soldat Dedicated Server Manager (beta)
Post by: Stuffy on August 13, 2010, 09:47:27 am
cool, seems to be better then Sars
Title: Re: Python Soldat Dedicated Server Manager (beta)
Post by: Beowulf Agate on August 23, 2010, 03:52:31 am
Cool script, thank you :)

Is it possible to add a feature, which will be trying to restart servers, from for exemple 3.00 am, whenever empty?
Title: Re: Python Soldat Dedicated Server Manager (beta)
Post by: jrgp on August 23, 2010, 04:56:29 am
Is it possible to add a feature, which will be trying to restart servers, from for exemple 3.00 am, whenever empty?

I might eventually be inclined to do so, yeah.
Title: Re: Python Soldat Dedicated Server Manager (beta)
Post by: Stuffy on September 21, 2010, 08:13:54 am
works quite good. Just one question: Is it possible to access the script-options while its running in the background?
Title: Re: Python Soldat Dedicated Server Manager (beta)
Post by: jrgp on September 21, 2010, 10:18:25 am
works quite good. Just one question: Is it possible to access the script-options while its running in the background?

I'm not sure what you mean. Can you be a little more specific?
Title: Re: Python Soldat Dedicated Server Manager (beta)
Post by: Stuffy on September 21, 2010, 10:43:18 am
I started the script with ./run.py &, so its running in the background. Now I'd like to use the commands, stopall, startall etc.. But I cant enter the commands because its running in the background. Is there any way to enter the commands or do I have to reopen it?
Title: Re: Python Soldat Dedicated Server Manager (beta)
Post by: jrgp on September 21, 2010, 03:03:23 pm
I started the script with ./run.py &, so its running in the background. Now I'd like to use the commands, stopall, startall etc.. But I cant enter the commands because its running in the background. Is there any way to enter the commands or do I have to reopen it?

I don't think you understand. It's intended to be ran tucked away out of reach. To run the commands you open a socket connection to it. eg, nc localhost 6969, then type what you want as I mentioned in the first post.
Title: Re: Python Soldat Dedicated Server Manager (beta)
Post by: Stuffy on September 21, 2010, 04:47:04 pm
well, my linux server doesnt know the commmand "nc" and if I try to connect with putty, I can connect put after I entered the password its says ok and the server disconnects me (im using windows as OS of my home pc).
Title: Re: Python Soldat Dedicated Server Manager (beta)
Post by: jrgp on September 24, 2010, 02:25:09 pm
well, my linux server doesnt know the commmand "nc" and if I try to connect with putty, I can connect put after I entered the password its says ok and the server disconnects me (im using windows as OS of my home pc).

Use telnet instead. Or in putty, tick the 'raw' radio button instead of 'SSH'.

Title: Re: Python Soldat Dedicated Server Manager (beta)
Post by: Stuffy on October 15, 2010, 02:24:39 pm
It cant start its socket server now. Worked fine, but after a server-restart, this error appeared. Any idea where the problem might be?
Title: Re: Python Soldat Dedicated Server Manager (beta)
Post by: jrgp on October 15, 2010, 02:28:41 pm
It cant start its socket server now. Worked fine, but after a server-restart, this error appeared. Any idea where the problem might be?

The script is probably still running and a new instance of it can't listen on the port. Make sure the script isn't already running before trying to start it again.
Title: Re: Python Soldat Dedicated Server Manager (beta)
Post by: Stuffy on October 15, 2010, 02:34:51 pm
Im sure that it isnt running in the background.
Title: Re: Python Soldat Dedicated Server Manager (beta)
Post by: jrgp on October 15, 2010, 03:28:08 pm
Im sure that it isnt running in the background.

killall -9 run.py
Title: Re: Python Soldat Dedicated Server Manager (beta)
Post by: Beowulf Agate on October 25, 2010, 01:19:59 pm
I have few questions about 'run.py' memory usage: How many RAM memory 'run.py' should use? Is RAM usage depends on the number of managed servers?
Title: Re: Python Soldat Dedicated Server Manager (beta)
Post by: jrgp on October 25, 2010, 01:31:11 pm
I have few questions about 'run.py' memory usage: How many RAM memory 'run.py' should use? Is RAM usage depends on the number of managed servers?

Probably very little since it isn't doing much.
Title: Re: Python Soldat Dedicated Server Manager (beta)
Post by: Beowulf Agate on October 25, 2010, 02:35:22 pm
Weird, cuz for me its like more servers managing = more RAM using, for 9 servers its eating about 100MB of RAM (im using it on Debian Lenny).
Title: Re: Python Soldat Dedicated Server Manager (beta)
Post by: jrgp on October 25, 2010, 02:38:57 pm
Weird, cuz for me its like more servers managing = more RAM using, for 9 servers its eating about 100MB of RAM (im using it on Debian Lenny).

I don't really see how that's a problem. If 100MB is too much for you then maybe check out the alternatives to this script that people like zakath/shoozza have written.
Title: Re: Python Soldat Dedicated Server Manager (beta)
Post by: Beowulf Agate on October 25, 2010, 02:53:13 pm
Ah, so that usage is normal? Cool, it's not a problem for me and i'll keep using your manager. I was just curious. Thank you.
Title: Re: Python Soldat Dedicated Server Manager (beta)
Post by: jrgp on October 25, 2010, 03:28:53 pm
Ah, so that usage is normal? Cool, it's not a problem for me and i'll keep using your manager. I was just curious. Thank you.

I honestly haven't tested this script out much, only enough to know that it works.
Title: Re: Python Soldat Dedicated Server Manager (beta)
Post by: Falcon` on December 23, 2010, 06:13:55 pm
Please add something to clean shut down it. Remotely too.

Also, this keeps disconnecting me from remote control randomly. Sometimes after valid password, sometimes after any other (proper or not) action. And i'm using putty.