Jump to content

Using PRM to Restart Services


bithead

Recommended Posts

Process Resource Monitor (PRM) is a great Linux script to help you monitor and manage out of control game services. You define a set of tolerable limits in a rule file for processes (by user or by process name) to monitor and take action on. To integrate PRM and TcAdmin, you must be careful to NOT kill the game service process, but to define a restart command in the rules file. This way, PRM will issue a restart of the service using TcAdmin. So, how do we do this? Add one file to the rules directory named tcagame.user (content follows).

 

Here is what I use for the rules/tcagame.user file:

# tcagame user monitor
#
# by - Don Pedersen             Snaju.com
#
# send comments or suggestions to [email="don@snaju.com"]don@snaju.com[/email]
IGNORE=""
# Change the following to something appropriate for your hosting environment
MAX_CPU="100"
# Change the following to something appropriate for your hosting environment
MAX_PROC="150"
# we dont care about the process run time, set value 0 to disable check
MAX_ETIME="0"
KILL_TRIG="3"
# we want to set a bit longer soft rechecks as sometimes the problem fixes
# itself
KILL_WAIT="20"
KILL_PARENT="0"
# Do not kill a tcadmin game service process, let tcadmin do it
# So, we will send the game service a HUP asking for a restart
# This works for games like minecraft.  You may have to pick another
# signal ( kill -l ) to pick something appropriate for your game service.
KILL_SIG="1"
# Let tcadmin restart the game service.  This is graceful and the user
# process will have a chance to save.
KILL_RESTART_CMD="/home/tcadmin/Monitor/servicebrowser -service=`pwdx $pid | sed 's,.*/,,'` -command=restart"

 

The guy that wrote PRM also has some incredible scripts, such as the APF firewall, Brute Force Detection, etc. Download PRM, run the install.sh script and add the rule file above to start monitoring and restarting tcadmin game services in a graceful manner. I also use PRM to monitor the mono processes of TcAdmin. TcAdmin has been fairly stable, but on occasion, it does run up the CPU and require a restart. PRM is perfect for such monitoring.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Who's Online   0 Members, 0 Anonymous, 45 Guests (See full list)

    • There are no registered users currently online
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. Terms of Use