Linux/howto

From GameCPWiki

Jump to: navigation, search

Contents

Server Monitor Settings

Usage: php -q  
  servermonitor.php 
    <rescan delay>  how long to wait before rescanning a server that is down

    <max load %>   the max load a server can have on linux, set HIGH!
    <0/1 overload restart>   0 = notify, 1 = restart

    <0/1 constant scan>  0 = cron, 1 = screen
    <constant delay>  delay before rescanning

    <0/1 private server ticket or kill> checks to see if the server is private
    <0/1 out of time ticket or kill>  for time based server rentals
    <0/1 send server down ticket> create a ticket when the server is down

Typical usage: php -q servermonitor.php 30 110 0 0 0 0 1 1


Windows Configuration

  • Login to your master web-server
  • Create a file, somewhere, named "gamecp-monitor.bat"
  • Right click and 'edit' the file
  • Type the following with paths relative to your install
cd C:\path\to\gamecp\system\
C:\path\to\php.exe php servermonitor.php 30 0 0 1 300 
  • Save the file
  • Run the file - the monitor should now launch and run for a long time

Linux Configuration

By default GameCP installs the server monitor into the master server cron.

  • Login to your master server via ROOT ssh
  • Edit the cron
crontab -e 
  • You may see a line similar to below:
15 * * * * cd /var/www/html/gcp/system ; php servermonitor.php 15 100 0 >> /var/log/gcp-monitor
  • The script will run every 15 mins. Adjust the time to your desired limit
  • Modify any other settings


You should 'Run in a screen using scontrol' - that is much better!


GameCP Settings

  • Login to GameCP
  • Browse to GameCP Settings
  • Click Server Monitor
  • Adjust the settings and click save.

To verify the monitor is running 'ps aux' on your GameCP web server to see if "servermonitor.php" is in a screen, if not use a method below.

Run in a screen using scontrol (recommended )

On your server (/usr/bin) create a file.

nano gcp-servermonitor.sh

#!/bin/bash
IP=0.0.0.0
PORT=0000
SCREEN=servermonitor
cd /path/to/gamecp/www/system/
STARTMODE="php -q servermonitor.php 30 110 0 1 30 0 0 0"

source /usr/local/gcp/sci/sci
Sudo to a user before you run the script.

GameCP wont let you run this as root, make sure the user you are sudoing to has access to the GameCP files.

Save this file

chmod +x gcp-servermonitor.sh

Start it

./gcp-servermonitor.sh start

You can set it to run on startup or run it manually.

Manaully run using a screen

If you want the RRDTOOL graphs to work you will need to run the server montior inside of a screen.

For some reason the rrdtool code does not work from cron.

Login to your server

screen -S gcp-graph
cd /path/to/gamecp (webfiles under /System/)
# change flags to suite your needs
php -q servermonitor.php 30 110 0 1 30 0 0 0 >> /var/log/gcp-monitor 

To detacth your screen type:

ctrl + a followed by ctrl + c

A script will be provided shortly to do this for you.

How-to Move /usr/local/gcp

This is a very basic overview on moving /usr/local/gcp to a new location

  • Backup GameCP
  • Login to your GameCP
  • Goto GameCP Settings > General
  • Locate Backend Path and Slave Path
  • Change these fields to your new path ie:
/home/gameinstalls/
  • Login to root SSH to all of your remote server(s)
  • Move your /usr/local/gcp folder to the new folder:
mv /usr/local/gcp/ /home/gameinstalls/
  • Edit the /usr/local/gcp/bin/data file
  • Change /usr/local/gcp to the new path
Personal tools
download
communication