Game server admin's helping the community setup and maintain great dedicated game servers.
----Home----Submit News ----Forum--------Guides----


Go Back   FPSadmin.com > Guides and Reviews > Medal of Honor

Reply
 
Thread Tools Display Modes
  #16  
Old 11-10-2006, 08:20 AM
Zepplin Zepplin is offline
Member
 
Join Date: Nov 2003
Location: Australia
Posts: 57
Rep Power: 15
Zepplin is on a distinguished road
Here's some files including one of my command lines from my server_list used to restart game servers when there down OS is centos

server_list

mohaa = cd /home/gs/mohaa/mohaa; screen -dmS mohaa ./mohaa_lnxded +set net_IP 203.88.125.104 +set net_port 12200 +set fs_basepath ./ +set com_zoneMegs 30 +set vm_game 0 +set ttycon 0 +set ui_console 1 +set dedicated 2 +set developer 2 +set cheats 0 +set fs_outputpath ./ +set sv_maxrate 15000 +exec server1.cfg
#

games.local

#!/bin/bash
/usr/bin/screen -dmS server_recovery /home/gs/server_recovery.pl

echo `date` >> /home/gs/games-local-log

server_recovery.pl

#!/usr/bin/perl -w

#use strict;

my $time_to_sleep = 30; # seconds
my $server_regex = '[A-Za-z0-9]{1,20}'; # regex matching a server name

use constant DEBUGGING => 0; # lots of debug info
use constant DRYRUN => 0; # don't actually start any servers
use constant SERVERS_FILE => '/home/gs/server_list';
use constant LOGFILENAME => '/home/gs/server_recovery.log'; # server = command format, # for comment lines
use constant LOGGING => 1;

if ($ARGV[0] =~ /restart/i) {
$oldoutput = `screen -ls`; # we are in optimum state, no server starting instantly required
} else {
$oldoutput = ''; # servers need to be started immidiately - we're NOT in optimum state
}

print "Old output: $oldoutput\n" if DEBUGGING;

while (1) {
$screenls = `screen -ls`;
print "New output: $screenls\n" if DEBUGGING;
#is screen -ls output the same as last time? If so, we're still fine
if ($oldoutput ne $screenls) {
print "Some differrence!" if DEBUGGING;
@output = split(/\n/, $screenls);
@required = ();
@runme = ();
@servers = ();
$line = '';
$req = '';
$command = '';
foreach $line (@output) {
if ($line =~ /^\s+\d+\.($server_regex)\s+(?:\(Detached\)|\(Attac hed\))$/i) {
push(@servers, $1);
print "Pushing $1 to servers from $line\n" if DEBUGGING;
}
}
$servers = "#" . join('#', @servers) . '#';
open (SERVERS, "<".SERVERS_FILE);
while (<SERVERS>) {
chomp;
s/#.*//;
s/^\s+//;
s/\s+$//;
next unless length;
if ( /($server_regex)\s*=\s*(.+)/ ) { # servername = command
$commands{$1} = $2;
push(@required, $1);
print "Commands $1 becoming $2 from $_\n" if DEBUGGING;
print "Pushing $1 to required from $_\n" if DEBUGGING;
}
}
close(SERVERS);

foreach $req (@required) {
if ($servers !~ /#$req#/) {
push(@runme, $commands{$req});
print "Pushing " . $commands{$req} . " to runme from $servers\n" if DEBUGGING;
}
}

foreach $command (@runme) {
unless (DRYRUN) {
$return = `$command`;
if (LOGGING) {
open (LOGFILE, ">>" . LOGFILENAME);
print LOGFILE "Performed $command at " . time() . ". Returned $return.\n";
close(LOGFILE);
}
}
print "Would execute: $command\n" if DRYRUN;
}

$oldoutput = `screen -ls`;
}

# Don't run too often - as often as the variable wants - conserves resources
sleep ($time_to_sleep);
}
Reply With Quote
  #17  
Old 11-11-2006, 04:52 PM
GaSplat's Avatar
GaSplat GaSplat is offline
Administrator
 
Join Date: Sep 2003
Location: St Louis
Posts: 2,454
Rep Power: 21
GaSplat is a glorious beacon of lightGaSplat is a glorious beacon of lightGaSplat is a glorious beacon of lightGaSplat is a glorious beacon of lightGaSplat is a glorious beacon of light
Truth be told, you really don't need to run mload.sh. Just open a shell and enter these commands (these are the only ones that do anything meaningful in mload.sh)

Code:
 
cd /usr/games/mohaa_tdm 

screen -S mohaa_tdm -m -d ./mlds.sh
You might also see if the system help has any entries for the screen command. I don't recall needing to enter a run directory so you might get by with different options or parameters. Bottom line, go to the mohaa directory and screen mlds.sh using whatever options you need. You can always try typing screen -help to see if the built in help can tell you anything. I suspect your screen syntax is different and its can't find the file. I have no clue why mload.sh won't run. You do have BASH installed as your shell, right? Many systems default to that. Try typing BASH (or bash - Linux is case sensitive) and see if that opens a different shell. If it does, then run your script from the new shell.
Reply With Quote
  #18  
Old 11-13-2006, 08:23 AM
Nat_Greene's Avatar
Nat_Greene Nat_Greene is offline
Senior Member
 
Join Date: Nov 2006
Location: Rhode Island
Age: 49
Posts: 103
Rep Power: 12
Nat_Greene is on a distinguished road
I did search and realized that many Linux distros don't come with the Screen utility installed. To install I keyed yum install screen (as SU) and it installed the screen utility. Go figure. Thanks for your help, I'll see how it works from here. BTW Fedora Core5 uses bash as it's default shell and I use gnome-terminal to access it.

Last edited by Nat_Greene; 11-13-2006 at 06:54 PM.
Reply With Quote
  #19  
Old 11-13-2006, 11:17 PM
GaSplat's Avatar
GaSplat GaSplat is offline
Administrator
 
Join Date: Sep 2003
Location: St Louis
Posts: 2,454
Rep Power: 21
GaSplat is a glorious beacon of lightGaSplat is a glorious beacon of lightGaSplat is a glorious beacon of lightGaSplat is a glorious beacon of lightGaSplat is a glorious beacon of light
No screen???!!!!!:confused: Screen is da bomb.

That should definitely help solve the problem.
Reply With Quote
  #20  
Old 11-17-2006, 10:23 AM
Nat_Greene's Avatar
Nat_Greene Nat_Greene is offline
Senior Member
 
Join Date: Nov 2006
Location: Rhode Island
Age: 49
Posts: 103
Rep Power: 12
Nat_Greene is on a distinguished road
Well, I was able to get the mload.sh script to load and also the mlds.sh script. The good news is that the server keeps running regardless of whether I'm logged in. The problem I'm having now is that the screen window still does not pop up and I can't control the server using gnome-terminal (bash). I figured out that I can shut it down by just killing the screen process.

Last edited by Nat_Greene; 11-17-2006 at 12:46 PM.
Reply With Quote
  #21  
Old 11-18-2006, 02:58 AM
GaSplat's Avatar
GaSplat GaSplat is offline
Administrator
 
Join Date: Sep 2003
Location: St Louis
Posts: 2,454
Rep Power: 21
GaSplat is a glorious beacon of lightGaSplat is a glorious beacon of lightGaSplat is a glorious beacon of lightGaSplat is a glorious beacon of lightGaSplat is a glorious beacon of light
scope out the docs on screen more.

man screen <- old school way

As long as you are logging back on with the same account that launched it, you should be able to reconnect to your server. I think the command is something like screen -r to reattach.
Reply With Quote
  #22  
Old 11-18-2006, 12:41 PM
Nat_Greene's Avatar
Nat_Greene Nat_Greene is offline
Senior Member
 
Join Date: Nov 2006
Location: Rhode Island
Age: 49
Posts: 103
Rep Power: 12
Nat_Greene is on a distinguished road
Thanks G-splat for the help! The screen -r command did the trick.

Any thoughts on the renice command in the loop script or a seperate script to devote more power to the server? The reason I want to do this is that 'm running the mohaa server on an old Dell Poweredge 2550 with a 1.2 GHz processor, 1 GB of ram and a 133MHz FSB. The server does nothing but run mohaa and that small FSB has me worried so I just wanted to devote as much power as possible to the game.

Thanks!
Reply With Quote
  #23  
Old 11-18-2006, 11:24 PM
GaSplat's Avatar
GaSplat GaSplat is offline
Administrator
 
Join Date: Sep 2003
Location: St Louis
Posts: 2,454
Rep Power: 21
GaSplat is a glorious beacon of lightGaSplat is a glorious beacon of lightGaSplat is a glorious beacon of lightGaSplat is a glorious beacon of lightGaSplat is a glorious beacon of light
This has a lot of really useful info. Note that if you are not root, your priority setting may be limited from 0 (highest) to 19 (lowest). If you are root, then -20 is the highest priority. ) may well be high enough. I would not run a program higher than -5. You don't want to preempt standard system programs.
Reply With Quote
  #24  
Old 11-22-2006, 11:47 AM
Nat_Greene's Avatar
Nat_Greene Nat_Greene is offline
Senior Member
 
Join Date: Nov 2006
Location: Rhode Island
Age: 49
Posts: 103
Rep Power: 12
Nat_Greene is on a distinguished road
Thanks GaSplat.

I am root (here me roar )so that's not a problem. I'm able to renice the process once it's running. As SU I just key renice -10 -p ##### (process number) and that works fine. I'm just totally inexperienced at actual script writing so I was asking for help on actually incorporating the renice command into the looping script. And if that's not possible I was just looking for some help writing a seperate script to handle the renice.

Thanks!
Reply With Quote
  #25  
Old 11-23-2006, 03:30 PM
GaSplat's Avatar
GaSplat GaSplat is offline
Administrator
 
Join Date: Sep 2003
Location: St Louis
Posts: 2,454
Rep Power: 21
GaSplat is a glorious beacon of lightGaSplat is a glorious beacon of lightGaSplat is a glorious beacon of lightGaSplat is a glorious beacon of lightGaSplat is a glorious beacon of light
Edit your mlds.sh like this

nice --adjustment=-10 ./mohaa_lnxded +set sv_chatter 1 +set developer 1 +exec servertest.cfg

Currently this line should be in your mlds.sh. Replace it with

According to the nice man page, that should result in its running at 0 priority. http://www.netadmintools.com/html/1nice.man.html

You can always just type nice to see what the current priorities are.

Good luck.
Reply With Quote
  #26  
Old 11-23-2006, 10:26 PM
Nat_Greene's Avatar
Nat_Greene Nat_Greene is offline
Senior Member
 
Join Date: Nov 2006
Location: Rhode Island
Age: 49
Posts: 103
Rep Power: 12
Nat_Greene is on a distinguished road
I will give it a try. Thanks!
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Remote Linux server management tricks Shockwave MOH:AA File Support 22 01-27-2008 07:00 PM
Start and Stop script made for Linux servers.. B3rt MOH:AA General Server Support 4 03-28-2006 07:55 PM
Linux Server Error radiance CoD UO General server Support 2 09-25-2004 08:15 AM
Keep alive script for linux ded? imported_jjbean CoD General server support 4 11-14-2003 05:21 PM
DogMeat's keep alive Linux Script Primal MOH:AA General Server Support 1 05-03-2003 06:55 AM


All times are GMT -4. The time now is 06:41 PM.


Powered by: vBulletin Copyright ©2000, Jelsoft Enterprises Ltd.