Author Topic: Python Soldat Dedicated Server Manager (beta)  (Read 6407 times)

0 Members and 1 Guest are viewing this topic.

Offline jrgp

  • Administrator
  • Flamebow Warrior
  • *****
  • Posts: 5018
Python Soldat Dedicated Server Manager (beta)
« 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.
« Last Edit: August 12, 2010, 01:34:27 pm by jrgp »
Careful with that axe, Eugene.

Offline Stuffy

  • Soldier
  • **
  • Posts: 182
  • Very stuffy.
    • Climb-Zone Forum
Re: Python Soldat Dedicated Server Manager (beta)
« Reply #1 on: August 13, 2010, 09:47:27 am »
cool, seems to be better then Sars
The truth is out there? Does anyone know the URL?
The URL is here

Offline Beowulf Agate

  • Major
  • *
  • Posts: 73
Re: Python Soldat Dedicated Server Manager (beta)
« Reply #2 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?

Offline jrgp

  • Administrator
  • Flamebow Warrior
  • *****
  • Posts: 5018
Re: Python Soldat Dedicated Server Manager (beta)
« Reply #3 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.
Careful with that axe, Eugene.

Offline Stuffy

  • Soldier
  • **
  • Posts: 182
  • Very stuffy.
    • Climb-Zone Forum
Re: Python Soldat Dedicated Server Manager (beta)
« Reply #4 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?
« Last Edit: September 21, 2010, 08:18:16 am by Stuffy »
The truth is out there? Does anyone know the URL?
The URL is here

Offline jrgp

  • Administrator
  • Flamebow Warrior
  • *****
  • Posts: 5018
Re: Python Soldat Dedicated Server Manager (beta)
« Reply #5 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?
Careful with that axe, Eugene.

Offline Stuffy

  • Soldier
  • **
  • Posts: 182
  • Very stuffy.
    • Climb-Zone Forum
Re: Python Soldat Dedicated Server Manager (beta)
« Reply #6 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?
The truth is out there? Does anyone know the URL?
The URL is here

Offline jrgp

  • Administrator
  • Flamebow Warrior
  • *****
  • Posts: 5018
Re: Python Soldat Dedicated Server Manager (beta)
« Reply #7 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.
Careful with that axe, Eugene.

Offline Stuffy

  • Soldier
  • **
  • Posts: 182
  • Very stuffy.
    • Climb-Zone Forum
Re: Python Soldat Dedicated Server Manager (beta)
« Reply #8 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).
The truth is out there? Does anyone know the URL?
The URL is here

Offline jrgp

  • Administrator
  • Flamebow Warrior
  • *****
  • Posts: 5018
Re: Python Soldat Dedicated Server Manager (beta)
« Reply #9 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'.

Careful with that axe, Eugene.

Offline Stuffy

  • Soldier
  • **
  • Posts: 182
  • Very stuffy.
    • Climb-Zone Forum
Re: Python Soldat Dedicated Server Manager (beta)
« Reply #10 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?
The truth is out there? Does anyone know the URL?
The URL is here

Offline jrgp

  • Administrator
  • Flamebow Warrior
  • *****
  • Posts: 5018
Re: Python Soldat Dedicated Server Manager (beta)
« Reply #11 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.
Careful with that axe, Eugene.

Offline Stuffy

  • Soldier
  • **
  • Posts: 182
  • Very stuffy.
    • Climb-Zone Forum
Re: Python Soldat Dedicated Server Manager (beta)
« Reply #12 on: October 15, 2010, 02:34:51 pm »
Im sure that it isnt running in the background.
The truth is out there? Does anyone know the URL?
The URL is here

Offline jrgp

  • Administrator
  • Flamebow Warrior
  • *****
  • Posts: 5018
Re: Python Soldat Dedicated Server Manager (beta)
« Reply #13 on: October 15, 2010, 03:28:08 pm »
Im sure that it isnt running in the background.

killall -9 run.py
Careful with that axe, Eugene.

Offline Beowulf Agate

  • Major
  • *
  • Posts: 73
Re: Python Soldat Dedicated Server Manager (beta)
« Reply #14 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?

Offline jrgp

  • Administrator
  • Flamebow Warrior
  • *****
  • Posts: 5018
Re: Python Soldat Dedicated Server Manager (beta)
« Reply #15 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.
Careful with that axe, Eugene.

Offline Beowulf Agate

  • Major
  • *
  • Posts: 73
Re: Python Soldat Dedicated Server Manager (beta)
« Reply #16 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).

Offline jrgp

  • Administrator
  • Flamebow Warrior
  • *****
  • Posts: 5018
Re: Python Soldat Dedicated Server Manager (beta)
« Reply #17 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.
Careful with that axe, Eugene.

Offline Beowulf Agate

  • Major
  • *
  • Posts: 73
Re: Python Soldat Dedicated Server Manager (beta)
« Reply #18 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.

Offline jrgp

  • Administrator
  • Flamebow Warrior
  • *****
  • Posts: 5018
Re: Python Soldat Dedicated Server Manager (beta)
« Reply #19 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.
Careful with that axe, Eugene.

Offline Falcon`

  • Flagrunner
  • ****
  • Posts: 792
  • A wanted lagger
Re: Python Soldat Dedicated Server Manager (beta)
« Reply #20 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.
« Last Edit: December 23, 2010, 06:41:13 pm by FalconPL »
If you're not paying for something, you're not the customer; you're the product being sold.
- Andrew Lewis

Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live.