|
|
|
|
 |

January 30th, 2009, 05:08 PM
|
 |
Shrapnel Fanatic
|
|
Join Date: Oct 2003
Location: Vacaville, CA, USA
Posts: 13,736
Thanks: 341
Thanked 479 Times in 326 Posts
|
|
Re: Linux Admining
Its not supposed to be a problem.
The host doesnt check its own key against the players. But Im pretty sure it does have to be a good key (cant use one off a public list since they get banned pretty quick). Ive used my own key with no trouble even when the host is on the linux server and Im playing from my windows desktop.
__________________
-- DISCLAIMER:
This game is NOT suitable for students, interns, apprentices, or anyone else who is expected to pass tests on a regular basis. Do not think about strategies while operating heavy machinery. Before beginning this game make arrangements for someone to check on you daily. If you find that your game has continued for more than 36 hours straight then you should consult a physician immediately (Do NOT show him the game!)
|
|
The Following User Says Thank You to Gandalf Parker For This Useful Post:
|
|

January 30th, 2009, 05:39 PM
|
|
Private
|
|
Join Date: May 2008
Posts: 29
Thanks: 3
Thanked 4 Times in 4 Posts
|
|
Re: Linux Admining
My server wrapper and backup scripts. For this thread, I think the interesting bit is the backup script, since it's parametrized by game name.
Both scripts assume the game directory is ~/dominions3
The server wrapper passes all parameters directly to dom3. It only deals with the last parameter, which is assumed to be the name of the game. The wrapper is mainly for having a bunch of default parameters that I want to have all the time.
The backup script writes the backups to ~/dominions/backups. It reads the scores.html file to determine current turn, so the game needs to be run with --scoredump on.
dom3serv:
Code:
#! /usr/bin/env python
from os import environ, execvp, mkdir
from os.path import exists, join
from sys import argv
# Common options
common = ["--scoredump",
"--tcpserver",
"--quickhost",
"--textonly"
]
# Newgame standard options
newgame = ["--masterpass", "*****",
"--renaming",
"--noscoregraphs"]
# Start game
HOME = environ["HOME"]
GAME = argv[-1]
EXECS = ["--preexec", "dom3backup %s" % (GAME,)
# ,"--postexec", "command %s" % (GAME,)
]
common = common + EXECS
if exists(join(HOME,"dominions3","savedgames",GAME,"ftherlnd")):
print "Resuming game %s" % (GAME,)
execvp("dom3", ["dom3"] + common + argv[1:])
else:
print "Starting new game %s" % (GAME,)
if not exists(join(HOME,"dominions3","savedgames",GAME)):
mkdir(join(HOME,"dominions3","savedgames",GAME))
execvp("dom3", ["dom3"] + common + newgame + argv[1:])
dom3backup:
Code:
#! /bin/bash
game=$1
savedir="$HOME/dominions3/savedgames"
gamedir="$savedir/$game"
backupdir="$HOME/dominions3/backups/$game"
fatherland="$gamedir/ftherlnd"
if [ ! -d $gamedir ]; then
echo "Can't backup non-existent game!"
exit
fi
if [ -f $fatherland ]; then
if [ -f $gamedir/scores.html ]; then
turn=`grep -Eo -m 1 "Dominions 3 Scores, $game turn ([[:digit:]]+)" $gamedir/scores.html | grep -Eo "[[:digit:]]+$"`
else
turn=1
fi
backupfile="$backupdir/turn_$turn.tar.bz2"
else
backupfile="$backupdir/pregame.tar.bz2"
fi
# Make sure backup dir exists
if [ ! -d $backupdir ]; then
mkdir -p $backupdir
fi
# Create backupfile for this turn
echo "Creating backup file $backupfile"
tar cjf $backupfile -C $savedir $game > /dev/null
Edit:
Regarding that unattendedness stuff, I run my server processes each in their own window under GNU screen, so they'll print their log to a terminal, but I don't have to have a local/remote login open all the time. But that's more a part of the fact that my setup currently requires me to start each game manually.
Last edited by Ornedan; January 30th, 2009 at 05:48 PM..
|
|
The Following User Says Thank You to Ornedan For This Useful Post:
|
|

January 31st, 2009, 04:25 AM
|
 |
Corporal
|
|
Join Date: Jan 2009
Location: Espoo, Finland
Posts: 147
Thanks: 23
Thanked 2 Times in 2 Posts
|
|
Re: Linux Admining
Thanks G
|

January 31st, 2009, 01:00 PM
|
 |
Shrapnel Fanatic
|
|
Join Date: Oct 2003
Location: Vacaville, CA, USA
Posts: 13,736
Thanks: 341
Thanked 479 Times in 326 Posts
|
|
Re: Linux Admining
Quote:
Originally Posted by Ornedan
My server wrapper and backup scripts. For this thread, I think the interesting bit is the backup script, since it's parametrized by game name.
|
Excellent scripts.
I will definetly copy them and use them as examples as I work on consolidating mine. My stuff grew over time and I have a script to start each game type, and a script to restart for each game type, and one to kill/delete for each game type, and one to search/display dead games which the players didnt bother to turn off. Not to mention the many version 1, version 2, test this, test that scripts.
I really need to clean it all up and create larger scripts with options, I especailly like how you broke the common options from the newgame options for start and restart.
__________________
-- DISCLAIMER:
This game is NOT suitable for students, interns, apprentices, or anyone else who is expected to pass tests on a regular basis. Do not think about strategies while operating heavy machinery. Before beginning this game make arrangements for someone to check on you daily. If you find that your game has continued for more than 36 hours straight then you should consult a physician immediately (Do NOT show him the game!)
|
| Thread Tools |
|
|
| Display Modes |
Hybrid Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is On
|
|
|
|
|