.com.unity Forums
  The Official e-Store of Shrapnel Games

This Month's Specials

Raging Tiger- Save $9.00
winSPMBT: Main Battle Tank- Save $6.00

   







Go Back   .com.unity Forums > Illwinter Game Design > Dominions 3: The Awakening

Reply
 
Thread Tools Display Modes
  #41  
Old September 18th, 2009, 04:08 AM
Lihaässä's Avatar

Lihaässä Lihaässä is offline
Corporal
 
Join Date: Jan 2009
Location: Espoo, Finland
Posts: 147
Thanks: 23
Thanked 2 Times in 2 Posts
Lihaässä is on a distinguished road
Default Re: Linux Admining

Yeah, after that it asks for the game name and this happens.

Code:
-- Waiting for participants to connect -- , time left: 1 seconds
Arcoscephale  open
Ermor  open
Man  open
Ulm  open
Marignon  open
Mictlan  open
T'ien Ch'i  open
Jomon  open
Agartha  open
Abysia  open
Caelum  open
C'tis  open
Pangaea  open
Midg�rd  human controlled
Utg�rd  open
Patala  open
Gath  open
Atlantis  open
R'lyeh  open
Pythium  open
Bogarus  open
Enter game name: rivers
N�got gick fel!
fg: bad u
N�got gick fel!
fg: bad u
dom_server.sh: line 19: 20308 Aborted                 $DOM -S -T --port $PORT $GAME --era $ERA --mapfile $MAP -q --indepstr 9 --uploadmaxp $START --diffai $AID --enablemod $MOD --preexec $BUP
Reply With Quote
  #42  
Old September 18th, 2009, 12:40 PM
Gandalf Parker's Avatar

Gandalf Parker Gandalf Parker is offline
Shrapnel Fanatic
 
Join Date: Oct 2003
Location: Vacaville, CA, USA
Posts: 13,736
Thanks: 341
Thanked 479 Times in 326 Posts
Gandalf Parker is on a distinguished road
Default Re: Linux Admining

I generally use pre.sh and post.sh

Also I think you want --preexec rather than --postexec

Once the game hosts, saving a copy is not much use since it will match the game itself. Players will complain about the hosting results in which case you want to be able to return to the files prior to hosting.

By the way, I find it more useful in many many ways to do
nice zip -9 game.zip * -x *game.zip -x z*
and then attach it to a email going to an address off-system.
That provides:
A) backup
B) dated multiple backups allowing restore to multiple points
C) security in case of system crashes or hard drive failures
D) ease of forwarding the latest games files to someone else in case they volunteer to pick up running the game for some reason
Reply With Quote
  #43  
Old September 20th, 2009, 03:33 PM
Lihaässä's Avatar

Lihaässä Lihaässä is offline
Corporal
 
Join Date: Jan 2009
Location: Espoo, Finland
Posts: 147
Thanks: 23
Thanked 2 Times in 2 Posts
Lihaässä is on a distinguished road
Default Re: Linux Admining

Thanks for the answers and help! I'm still struggling with the script, but will make it work somehow. Fortunately backing up files isn't mandatory. Happiness is
Reply With Quote
  #44  
Old September 23rd, 2009, 02:05 PM
Lihaässä's Avatar

Lihaässä Lihaässä is offline
Corporal
 
Join Date: Jan 2009
Location: Espoo, Finland
Posts: 147
Thanks: 23
Thanked 2 Times in 2 Posts
Lihaässä is on a distinguished road
Default Re: Linux Admining

Done! Thanks to my awesome anonymous friend and you guys my script is ready for hosting. Feel free to copy if you need such a simple script.

Code:
#!/bin/bash
# Tällä käynnistellään dqotonen domi hostaukset
# Jos tämä toimii siis!

GAME="Rivers"
MAP="Rivers.map"
ERA="3"
MOD="CBcomplete_1.6.dm"
AID="0" 
NID="0" 
START="5"
HOF="15"
IND="5"

PORT="3737"
DOM="/home/dom/dominions3/dom3"

$DOM -S -T --port $PORT $GAME --era $ERA --mapfile $MAP \
-q --indepstr $IND --uploadmaxp $START --diffai $AID --normai $NID \
--noscoregraphs --hofsize $HOF --enablemod $MOD \
--preexec /home/dom/backup.sh
Code:
#!/bin/bash
rsync -a /home/dom/dominions3/savedgames/ /home/dom/dominions3/backup/
Reply With Quote
The Following User Says Thank You to Lihaässä For This Useful Post:
  #45  
Old September 24th, 2009, 04:04 AM

Ornedan Ornedan is offline
Private
 
Join Date: May 2008
Posts: 29
Thanks: 3
Thanked 4 Times in 4 Posts
Ornedan is on a distinguished road
Default Re: Linux Admining

Quote:
Originally Posted by Lihaässä View Post
Code:
#!/bin/bash
rsync -a /home/dom/dominions3/savedgames/ /home/dom/dominions3/backup/
I see a couple of problems here:
  • You copy all games every time any game hosts. Which clobbers the backups of all games other than the one about to be hosted.
  • You only maintain a backup of the latest turn. This will cause trouble when the game manages to **** itself up so that it crashes at next hosting, because by the time you notice it crashing, you've clobbered the backup from before it broke.
    (Yes, this can happen. Guess what made me think it was a good thing I was already backing up all truns?)

If you look approximately halfway up the thread, I've posted a backup script that has neither of those particular issues.
Reply With Quote
The Following User Says Thank You to Ornedan For This Useful Post:
  #46  
Old September 24th, 2009, 08:52 AM
Lihaässä's Avatar

Lihaässä Lihaässä is offline
Corporal
 
Join Date: Jan 2009
Location: Espoo, Finland
Posts: 147
Thanks: 23
Thanked 2 Times in 2 Posts
Lihaässä is on a distinguished road
Default Re: Linux Admining

You are correct, the script is simple but easily altered to backup only one game.. in this case /home/dom/dominions3/backup/Rivers/
I hope that the game won't crash and use this one.

Your script was too much for me and I didn't understand it. Thanks for your input. I will look it again when I find the time.
Reply With Quote
  #47  
Old September 24th, 2009, 09:24 AM

Ornedan Ornedan is offline
Private
 
Join Date: May 2008
Posts: 29
Thanks: 3
Thanked 4 Times in 4 Posts
Ornedan is on a distinguished road
Default Re: Linux Admining

Most of my backup script is about finding the current turn number and handling edge cases like being somehow called to backup a non-existent game (not detecting conditions like that will at best result in the script crashing and at worst data loss as it goes blindly ahead to do something stupid).


Doing
Code:
--preexec /home/dom/backup.sh "$GAME"
and
Code:
#!/bin/bash
rsync -a "/home/dom/dominions3/savedgames/$1" /home/dom/dominions3/backup
would have your backup command be parametrised by game name, so it'll backup each game to separate directory. Though I guess that might have been what you meant?
Reply With Quote
The Following User Says Thank You to Ornedan For This Useful Post:
  #48  
Old September 24th, 2009, 10:23 AM

Ornedan Ornedan is offline
Private
 
Join Date: May 2008
Posts: 29
Thanks: 3
Thanked 4 Times in 4 Posts
Ornedan is on a distinguished road
Default Re: Linux Admining

Looks like edit period ran out... It should have been
Code:
--preexec "/home/dom/backup.sh \"$GAME\""
Reply With Quote
  #49  
Old September 24th, 2009, 10:48 AM
Lihaässä's Avatar

Lihaässä Lihaässä is offline
Corporal
 
Join Date: Jan 2009
Location: Espoo, Finland
Posts: 147
Thanks: 23
Thanked 2 Times in 2 Posts
Lihaässä is on a distinguished road
Default Re: Linux Admining

It works perfectly!
Reply With Quote
  #50  
Old September 30th, 2009, 07:00 AM
lch's Avatar

lch lch is offline
General
 
Join Date: Feb 2007
Location: R'lyeh
Posts: 3,861
Thanks: 144
Thanked 403 Times in 176 Posts
lch is on a distinguished road
Default Re: Linux Admining

Hi there, I see that people are sharing their Linux server scripts here. In case it helps: somebody contacted me about the Linux server scripts that I use for administrating my Dom3 games around June, here's what I sent back. Configuration is done by editing the GAME and PORT variables inside the scripts, and by setting the player's email addresses for email notification in the post-exec script.

Main script "MyGame.sh", this is being started in a "screen" session
PHP Code:
#!/bin/bash

GAME=MyGame
PORT
=1337
DIR
="/home/dom3/dominions3/savedgames/"$GAME

mkdir $DIR 
&>/dev/null

# reset timer for the stats.php script
if [ -e $DIR/ftherlnd ]
then
  touch $DIR
/ftherlnd
fi

~/Dom3/dom3 $GAME --port $PORT -STddd --scoredump --renaming \
--
era 2 --mapfile 'MyGameMap.map' \
-
\
--
masterpass MyGamePassword \
--
noclientstart --uploadmaxp 7 \
--
hofsize 15 --indepstr 6 --renaming \
--
preexec /home/dom3/dominions3/${GAME}_pre.sh --postexec /home/dom3/dominions3/${GAME}_post.sh \
>>
$DIR/$GAME.log 2>>$DIR/$GAME.err 
Pre-hosting script "MyGame_pre.sh", this is being started before hosting and makes a backup of the game/turn data
PHP Code:
#!/bin/bash

GAME=MyGame
PORT
=1337
DIR
="/home/dom3/dominions3/savedgames/$GAME"

# make backups
pushd "$DIR/.."
tar czf "/home/dom3/dominions3/backups/"$GAME-$(date +%s)-pre.tgz $GAME
popd

# blank the log files after backup
cp /dev/null $DIR/$GAME.log
cp 
/dev/null $DIR/$GAME.err 
Post-hosting script "MyGame_post.sh", this is being started after hosting and makes a backup of the game/turn data, updates my online game statistics and sends a notification to the other players
PHP Code:
#!/bin/bash

GAME=MyGame
PORT
=1337
GAMElow
=`echo $GAME | tr "[:upper:]" "[:lower:]"`
DIR="/home/dom3/dominions3/savedgames/$GAME"
SENDMAIL="sendmail -t "

# make backups & save scores
pushd "$DIR/.."
tar czf "/home/dom3/dominions3/backups/"$GAME-$(date +%s)-post.tgz $GAME
php 
/home/dom3/dominions3/backups/scores2mysql.php "$GAME/scores.html"
popd

# blank the log files after backup
cp /dev/null $DIR/$GAME.log
cp 
/dev/null $DIR/$GAME.err

# email notify players that have asked to be told of turns
Player1=player1@email.com
Player2
=player2@email.com
Player3
=player3@email.com
Player4
=player4@email.com
Player5
=player5@email.com
Player6
=player6@email.com

# the actual sendmail needs a single dot "." in the last line at the end of the message, nbsmtp does not
$SENDMAIL <<EOF
From
'$GAME' Dom3 game server <$GAMElow@my-own.email>
Bcc$Player1$Player2$Player3$Player4$Player5$Player6$GAMElow@my-own.email
Subject
$GAME has hosted!

The Dominions 3 game you are playing in ($GAMEhas processed a new turn.
Please connect to server dom3.servegame.com port $PORT to play your next turn!

Here is the turn status page for the gamehttp://dom3.servegame.com/stats/stats.php?game=$GAME

EOF 
I am not hosting games right now and my Dom3 activities are in hiatus, but maybe these shell scripts are an inspiration for somebody else. I needed to use PHP syntax highlighting environment here because the CODE environment doesn't display the shell code correctly. (double <)
__________________
Come to the Dom3 Wiki and help us to build the biggest Dominions-centered knowledge base on the net.
Visit my personal user page there, too!
Pretender file password recovery
Emergency comic relief

Last edited by lch; September 30th, 2009 at 07:11 AM..
Reply With Quote
The Following 2 Users Say Thank You to lch For This Useful Post:
Reply

Bookmarks

Tags
admin, automation, command line, hosting, linux, script, server, switches


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 On

Forum Jump


All times are GMT -4. The time now is 11:59 AM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©1999 - 2024, Shrapnel Games, Inc. - All Rights Reserved.