Scripts and logs for multiple servers

Post here if you need help setting up your server, etc.
User avatar
dukevin
Round Winner
Posts: 219
Joined: Mon Aug 30, 2010 8:25 am
Location: Southern California
Contact:

Scripts and logs for multiple servers

Post by dukevin »

I have several servers running on Debian OS
The tree looks like this:

Code: Select all

/aa/
| 
 /bin
 /etc
 /logs
 /scripts
   |
    start
    srv
 /servers
   |
    /server1
    /server2
    /server3
      |
        /var
          |
            <cfg files>
Right now, all the log files for each server are stored in /aa/logs/, but how can I make the logs be stored in /aa/servers/server1/logs/ instead, sorted into individual server directories, as described on http://wiki.armagetronad.net/index.php? ... x_computer ? Also, if I want to run custom scripts, how can I run them on only 1 of the servers? I'm assuming in server1/scripts but the only /scripts I see are in /aa/scripts and manually creating this directory doesn't seem to work (I think).
Image
User avatar
AI-team
Shutout Match Winner
Posts: 1020
Joined: Tue Jun 23, 2009 6:17 pm
Location: Germany/Munich
Contact:

Re: Scripts and logs for multiple servers

Post by AI-team »

About the logs:
When starting your server using this script, you can easily define your log/var directories:

Code: Select all

armagetronad-dedicated --vardir var/1/ --configdir cfg/1/ 
About the scripts:
Assuming you're running sty+ct, start your server like this:

Code: Select all

#!/bin/sh
tron="/path/to/bin/armagetronad-dedicated"
var="/path/to/var/"
log="${var}console_log.txt"
userconfigdir="/path/to/config/"
parser="/path/to/parser.php"
ladderlog="${var}ladderlog.txt"
 
tail -n0 -f -s 0.01 $ladderlog | $parser | $tron --userconfigdir $userconfigdir --vardir $var | tee -a $log
More information on how to start a sty+ct server: http://crazy-tronners.com/wiki/index.ph ... g_a_Server
  
 
"95% of people believe in every quote you post on the internet" ~ Abraham Lincoln
 
 
User avatar
dukevin
Round Winner
Posts: 219
Joined: Mon Aug 30, 2010 8:25 am
Location: Southern California
Contact:

Re: Scripts and logs for multiple servers

Post by dukevin »

AI-team wrote:About the logs:
When starting your server using this script, you can easily define your log/var directories:

Code: Select all

armagetronad-dedicated --vardir var/1/ --configdir cfg/1/ 
Thanks! Would you mind clarifying though?

do I replace 1 with the name of the server?

Assuming server name is 'server1'
vardir var/server1 --configdir cfg/server1/ ?
Image
User avatar
AI-team
Shutout Match Winner
Posts: 1020
Joined: Tue Jun 23, 2009 6:17 pm
Location: Germany/Munich
Contact:

Re: Scripts and logs for multiple servers

Post by AI-team »

dukevin wrote:
AI-team wrote:About the logs:
When starting your server using this script, you can easily define your log/var directories:

Code: Select all

armagetronad-dedicated --vardir var/1/ --configdir cfg/1/ 
Thanks! Would you mind clarifying though?

do I replace 1 with the name of the server?

Assuming server name is 'server1'
vardir var/server1 --configdir cfg/server1/ ?
I recommend you to make your tree look like this:

Code: Select all

/aa/
| 
/bin
/etc
/logs
/scripts
   |
    start
    srv
/servers
   |
    /server1
    /server2
    /server3
      |
        /cfg
          |
            <cfg files>
        /var 
           | 
             <log files>
Based on this tree, the starter-scripts are supposed to look like this:

No scripts involved:

Code: Select all

bin/armagetronad-dedicated --vardir servers/server1/var/ --configdir servers/server1/cfg/ 
Server running scripts:

Code: Select all

#!/bin/sh
tron="bin/armagetronad-dedicated"
var="server/server1/var/"
log="${var}console_log.txt"
userconfigdir="server/server1/cfg/"
parser="/path/to/parser.php"
ladderlog="${var}ladderlog.txt"

tail -n0 -f -s 0.01 $ladderlog | $parser | $tron --userconfigdir $userconfigdir --vardir $var | tee -a $log
(All these scripts are based on the assumption that you're working in ./aa/)
  
 
"95% of people believe in every quote you post on the internet" ~ Abraham Lincoln
 
 
User avatar
dukevin
Round Winner
Posts: 219
Joined: Mon Aug 30, 2010 8:25 am
Location: Southern California
Contact:

Re: Scripts and logs for multiple servers

Post by dukevin »

Hm, I ran exactly what you wrote while in the ./aa/ dir
and get the output

Code: Select all

vps:/home/duke/aa# bin/armagetronad-dedicated --vardir servers/server1/var/ --configdir servers/server1/cfg/

Error: Error in int main(int, char**) in tron/gArmagetron.cpp:660 :
        Configuration files not found. Check your installation.
Prior to running this command, I have made an empty server1/ directory, if that matters.
Image
User avatar
kyle
Reverse Outside Corner Grinder
Posts: 1975
Joined: Thu Jun 08, 2006 3:33 pm
Location: Indiana, USA, Earth, Milky Way Galaxy, Universe, Multiverse
Contact:

Re: Scripts and logs for multiple servers

Post by kyle »

you need the full pat most likely
Image
User avatar
dukevin
Round Winner
Posts: 219
Joined: Mon Aug 30, 2010 8:25 am
Location: Southern California
Contact:

Re: Scripts and logs for multiple servers

Post by dukevin »

I tried full paths

Code: Select all

vps:/home/duke/aa# bin/armagetronad-dedicated --vardir home/duke/aa/servers/demo/var/ --configdir  home/duke/aa/servers/demo/cfg/
Error: Error in int main(int, char**) in tron/gArmagetron.cpp:660 :
        Configuration files not found. Check your installation.
Still no luck
Image
User avatar
kyle
Reverse Outside Corner Grinder
Posts: 1975
Joined: Thu Jun 08, 2006 3:33 pm
Location: Indiana, USA, Earth, Milky Way Galaxy, Universe, Multiverse
Contact:

Re: Scripts and logs for multiple servers

Post by kyle »

use --userconfigdir instead
so

Code: Select all

vps:/home/duke/aa# bin/armagetronad-dedicated --vardir home/duke/aa/servers/demo/var/ --userconfigdir  home/duke/aa/servers/demo/cfg/
Image
User avatar
dukevin
Round Winner
Posts: 219
Joined: Mon Aug 30, 2010 8:25 am
Location: Southern California
Contact:

Re: Scripts and logs for multiple servers

Post by dukevin »

it took it that time, and I see server output.

However, it didn't work.

I manually created /server1/var and /server1/cfg and put settings_custom.cfg and server_info.cfg in server1/cfg (with talk_to_master and all that stuff) and the server wouldn't go online. But, I copyed the cfg's into var and it worked.

What can I do to make it so I can have the cfg's in /cfg?
Image
User avatar
AI-team
Shutout Match Winner
Posts: 1020
Joined: Tue Jun 23, 2009 6:17 pm
Location: Germany/Munich
Contact:

Re: Scripts and logs for multiple servers

Post by AI-team »

So you're using the script kyle pasted?
  
 
"95% of people believe in every quote you post on the internet" ~ Abraham Lincoln
 
 
User avatar
dukevin
Round Winner
Posts: 219
Joined: Mon Aug 30, 2010 8:25 am
Location: Southern California
Contact:

Re: Scripts and logs for multiple servers

Post by dukevin »

AI-team wrote:So you're using the script kyle pasted?
Ah, missed that...

Quick, stupid question:
Where does this script go? In aa/scripts/start? Do I replace or append the ./start file?
If so, I'm assuming I have to update this script for every server I want to have logs in a different directory.
Image
User avatar
AI-team
Shutout Match Winner
Posts: 1020
Joined: Tue Jun 23, 2009 6:17 pm
Location: Germany/Munich
Contact:

Re: Scripts and logs for multiple servers

Post by AI-team »

the above scripts have nothing to do with the serverstarter script, so you need x scripts for x servers.

you might as well want to use this bash script, should be working ( I didn't test it yet).

Code: Select all

#!/bin/sh
#scriptname: "starter.sh"
screen -m -S $1 bin/armagetronad-dedicated --vardir /home/duke/aa/servers/server$1/cfg/ --configdir /home/duke/aa/servers/server$1/cfg/
start your server like this

Code: Select all

./starter.sh <server#>
  
 
"95% of people believe in every quote you post on the internet" ~ Abraham Lincoln
 
 
User avatar
dukevin
Round Winner
Posts: 219
Joined: Mon Aug 30, 2010 8:25 am
Location: Southern California
Contact:

Re: Scripts and logs for multiple servers

Post by dukevin »

Ah, I'm kind of confused

Do I use your script instead of kyle's or with kyle's?

Also, for kyle's script, do I create a new file for that script and run it?
Image
User avatar
AI-team
Shutout Match Winner
Posts: 1020
Joined: Tue Jun 23, 2009 6:17 pm
Location: Germany/Munich
Contact:

Re: Scripts and logs for multiple servers

Post by AI-team »

use mine instead of kyle's
  
 
"95% of people believe in every quote you post on the internet" ~ Abraham Lincoln
 
 
User avatar
dukevin
Round Winner
Posts: 219
Joined: Mon Aug 30, 2010 8:25 am
Location: Southern California
Contact:

Re: Scripts and logs for multiple servers

Post by dukevin »

AI-team wrote:the above scripts have nothing to do with the serverstarter script, so you need x scripts for x servers.

you might as well want to use this bash script, should be working ( I didn't test it yet).

Code: Select all

#!/bin/sh
#scriptname: "starter.sh"
screen -m -S $1 bin/armagetronad-dedicated --vardir /home/duke/aa/servers/server$1/cfg/ --configdir /home/duke/aa/servers/server$1/cfg/
start your server like this

Code: Select all

./starter.sh <server#>
I don't actually want to call my servers 'server1' or 'server2' :P

Assuming my server is 'test' (/servers/test/) I created empty directories test/cfg and test/var then ran this

Code: Select all

#!/bin/sh
#scriptname: "starter.sh"
screen -m -S $1 bin/armagetronad-dedicated --vardir /home/duke/aa/servers/test/cfg/ --configdir /home/duke/aa/servers/test/cfg/

Code: Select all

./starter.sh test
Not working, I probably messed something up by calling my server test instead of server1 :P
Image
Post Reply