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

This Month's Specials

BCT Commander- Save $8.00
winSPWW2- Save $5.00

   







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

Reply
 
Thread Tools Display Modes
  #61  
Old April 22nd, 2010, 11: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

servers see everything
OK It has come up that someone has accessed someone elses nation and changed their turn actions. This has been verified. Its not unexpected and Ive been prepared for a long time. Yes I know that "is what happens when you dont password protect your god" or by using sloppy passwords when playing network games. Getting caught at it is also what happens when you play network games. Servers see EVERYTHING.

Servers can see what IP uploads a turn. So the servers are able to see who is using player files they shouldnt be using.
Example for Linux
Code:
while [ x ]
do
cat IPlog.txt|grep \*|sort |uniq >IPusers.txt

for x in `seq 1 1000`
do

netstat -n |grep 63.199.8.157:8|cut -d: -f2 >listIP.txt
cat listIP.txt|\
while read PID IP
 do
  if [ $PID ]
   then
    GAME=`ps ax|grep dom3|grep $PID|cut -dg -f2|cut -d" " -f2`
    LOGINS=`tail -1 $DIR/$GAME/game.log`
    echo $IP" "$GAME" "$LOGINS >>IPlog.txt
  fi
 done

sleep 10
done
done
Also, if the user is the same as is in the game, or any game on that server then the 2h files can be checked for matching serials. The dom3 command switch of --verify gamename will create .chk files for each .2h and part of the information is a serial hash.

example for linux
Code:
cd ~/dominions3/savedgames

for gaym in `ls -1`
do
   nice dom3 --verify $gaym
done

grep serial */*.chk |cut -d" " -f4 |sort -n |uniq -c |sort -n
cd -
Reply With Quote
The Following User Says Thank You to Gandalf Parker For This Useful Post:
  #62  
Old May 5th, 2010, 11:34 AM
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

OK yet another lesson learned (that makes me look bad).

It appears that Dom3 can develop a problem. Im still trying to pin it down. Possibly something with the way a player disconnects. Im thinking maybe by hitting the red X in the upper right corner (in windowed mode) killing his program, instead of using the disconnect button on the menu when connected to the server. What I get is a log file full of continual (and very fast unfortunately) messages about trying to resend a packet. In any case, the result is a log file that grows larger and larger and larger until it fills up the machine and starts to crash things.

The fix? I havent quite decided yet. Dont use debug logs? I dont use them all the time but when I do they are extremely useful. Or a watchdog script that "sees" the runaway log-growth and kills that game? Im abit to eager to do watchdogs. Im beginning to think I have too many running now. Or maybe keep the logs on a different drive? I can do that. Have the logs write to the /backup which is a separate hard drive. That way at least when it fills up it wont crash other things. But that will make game cleanup alot more complicated. I have enough of that already.
Reply With Quote
  #63  
Old May 5th, 2010, 12:24 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

hmmm... I wonder if I can get along with a soft link to the separate drive. That way the game.log in the games directory is kept elsewhere but can be cleaned up with the game
Reply With Quote
  #64  
Old July 16th, 2010, 12:48 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

OK we are back to the runaway logs problem.
There might be two versions. One that does continual packet messages which might be due to users not disconnecting properly (killing dom3 instead of using the quit). And one where a combat loops. Unfortunately, when it happens the panic to fix it before it wipes out the whole server tends to destroy the evidence of what caused it. Oops, my bad. Hey, no one else seems to be coughing up anything helpful.

This is NOT what I planned to do today. But I might get around to testing out soft links. That would be my best bet since it would not mean totally rewriting all the scripts from scratch.

The next option would be a watchdog script to continually watch for the harddrive getting 90% full then text messaging me. For just this problem that would seem to be sloppy and overkill but on the other hand it would be a reasonable thing to have in place since runaway processes and runaway logs CAN be caused by other programs on the system (much rarer but it can happen). I should probably do a search since it seems like someone might have already come up with something along this line that I can just download.

The last option would be redesigning the whole Dom3 games setups. There are many "gee I wish you would" on the lists that could be tackled at the same time. I really thought someone else would have done a "serious direct server" by now to match the quality of the two excellent PbEM servers and one excellent game registration server. This choice is abit of a daunting task since the scripts are SOOooooooo spaghettied now. Virtual drives? Hard and Soft Links? Split game directories using Dom3's internal variables like DOM3_DATA or DOM3_CONF? Dom3 already hogs the /tmp directory far beyond any other internet service and does a lacking job of cleaning up (something else on the need-to-script list).

Another plus to the redesign and rewrite options is the number of games is hitting a max. If I keep doing the always-open blitz-type games then I might need to create a new account to manage the games other people are having me host. It would make it easier to keep one from impacting the other. I keep hitting the limit on maps or game directories or mods. I dont THINK splitting the "user" would split the cpu load but Id have to test that. And as long as Im considering a new user with hard-set limits I MIGHT consider adding another for the must-have-a-menu crowd to put into play something like
http://www.dom3minions.com/lab/MakeGame.htm which has been around longer than anyones. Altho Im still not sure about automation on a server that isnt totally Dom3 dedicated. Pros and Cons.
Reply With Quote
  #65  
Old October 16th, 2010, 04:00 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

OK this is for a game with a 24 hour host timer that wanted 12 hour reminders.

# if the game name is "megagame" then I use queue M or queue m
# so in the pre.sh

# remove the old reminder timer in case quickturn kicked in
atrm `atq |grep "M domgames"|cut -f1 `
# set a new timer to run reminders.sh in 12 hours in queue P
at -f reminders.sh -v now + 12 hours -q M

# then the reminders.sh has a line for each nation and its owner
# if fatherland is newer than the last .2h for that nation then email
if [ ftherlnd -nt early_pangaea.2h ] ; then echo "waiting for your turn" \
|mail -s "MegaGame is waiting" gandalf@community.net ; fi

I could tighten it up abit by adding a check of the stats.txt for whether the nation is still playing and not AI to avoid false reminders. Maybe later.
Reply With Quote
  #66  
Old October 22nd, 2010, 06:56 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

Now I have a new "check the game" script for personal games on the server. So far it looks like this..
Code:
Dominions 3 Scores, goongame turn 16

    goongame, Connections 1, Time 22h (quick host) 
*Py- (Man) Mac+ Ag- Ca+ Jo+ shi+ As-  


mid_agartha.2h 
mid_bakemono.trn*
mid_caelum.trn*
mid_gath.trn*
mid_jotunheim.trn*
mid_machaka.2h 
mid_man.2h 
mid_pythium.2h 
mid_vanheim.2h 

If the game is called goongame then cat goongame.cgi gives

HTML Code:
#!/bin/bash
echo "Content-type: text/html"
echo -e "\n\n"

cd /home/domgames/dominions3/savedgames/goongame/
head -9 scores.html
echo "<html>"
echo "<h4>"
tail game.log | \
grep Connections | tail -n 1
echo ""
tail game.log | \
egrep "\-|\+" |tail -n 1
echo ""
echo "</h4>"

  for fyle in `ls -1 *.2h`
    do
      nation=`echo $fyle|cut -d. -f1`
      if [ $nation.trn -nt ftherlnd ]
        then echo $nation".trn<font color=red>*</font>"
       else
        echo "<font color=black>"$nation".2h </font>"
      fi
    done

echo "</html>"
The first sections grabs the top of goongames latest scores.html (which dom3 creates).
That gives us a nice html header, and title, game name, and the turn number.

The next section grabs the tail end of the game.log twice (created by the dom3 debug switch).
That gives us game name, how much time is left on the timer, and the note (quickhost) if its on.
then it lists the nations and lets us know who is connected *, who has done a turn +, who hasnt done a turn -, and who is AI ( ).

The final section lists the player files with a red asterisk on anyone the game is still waiting on. Yes thats redundant but it has two purposes. The file names are sometimes clearer than the 2-letter codes, and it works even BEFORE the game starts so it makes an easy way for the person who is running the game to see who has turned in a pretender.

All of this is so that people can use a browser to check their games status as much as possible without having to load up Dom3 to connect in order to see it.

Last edited by Gandalf Parker; October 22nd, 2010 at 07:09 PM..
Reply With Quote
  #67  
Old September 10th, 2011, 02:38 PM

Mark Weston Mark Weston is offline
Private
 
Join Date: May 2010
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Mark Weston is on a distinguished road
Default Re: Linux Admining

I know this isn't quite a linux question, but it seems like the right place.

I was planning on trying to host some games from my Mac. I figured this would be straightforward because the Mac is a unix based OS, and I've done it from a Linux machine before.

But I can't get it to run in a properly text-only mode as a background process. Has anyone had any luck doing this?
Reply With Quote
  #68  
Old September 10th, 2011, 02:53 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

Well I can give you an answer for Linux test-mode...

Here is an example script from my system of an actual game..
Code:
nohup nice dom3 --era 2 -g Warhammergoons --port 28911 -STddd \
--statfile --scoredump -q --hours 48 \
--preexec /home/domgames/dominions3/savedgames/Warhammergoons/pre.sh \
--postexec /home/domgames/dominions3/savedgames/Warhammergoons/post.sh \
--renaming --hofsize 15 \
--enablemod Expanded_Nations_1_v1_02.dm --masterpass xxxxxx \
--mapfile Streamlands_8P_warhammer.map \
 >/home/domgames/dominions3/savedgames/Warhammergoons/game.log \
 2>/home/domgames/dominions3/savedgames/Warhammergoons/game.err &
Some of the non-Dom3 elements are
nohup: No Hangup command so I can log off without the game dying
nice: so it doesnt hog the CPU
&: the ampersand at the very end of the script is what tells it to run in background

a common error is running it & (background) but forgetting nohup (no hangup) so when you logoff, it dies
Reply With Quote
  #69  
Old September 14th, 2011, 05:20 PM

JonBrave JonBrave is offline
Second Lieutenant
 
Join Date: Aug 2010
Posts: 546
Thanks: 100
Thanked 10 Times in 8 Posts
JonBrave is on a distinguished road
Default Re: Linux Admining

I was about to say: I haven't seen a Unix command in about 20 years. I see people are still writing "nohup nice ... &", amazing

I used to use /bin/csh. Do I vaguely recall, there you didn't have to "nohup" if you "&"-ed, because its background processes were automatically immune?
Reply With Quote
  #70  
Old July 1st, 2012, 12:25 PM

GenericOverusedName GenericOverusedName is offline
Private
 
Join Date: Mar 2012
Posts: 2
Thanks: 0
Thanked 1 Time in 1 Post
GenericOverusedName is on a distinguished road
Default Re: Linux Admining

Quote:
Originally Posted by Gandalf Parker View Post
Well I can give you an answer for Linux test-mode...

Here is an example script from my system of an actual game..
Code:
nohup nice dom3 --era 2 -g Warhammergoons --port 28911 -STddd \
--statfile --scoredump -q --hours 48 \
--preexec /home/domgames/dominions3/savedgames/Warhammergoons/pre.sh \
--postexec /home/domgames/dominions3/savedgames/Warhammergoons/post.sh \
--renaming --hofsize 15 \
--enablemod Expanded_Nations_1_v1_02.dm --masterpass xxxxxx \
--mapfile Streamlands_8P_warhammer.map \
 >/home/domgames/dominions3/savedgames/Warhammergoons/game.log \
 2>/home/domgames/dominions3/savedgames/Warhammergoons/game.err &
Some of the non-Dom3 elements are
nohup: No Hangup command so I can log off without the game dying
nice: so it doesnt hog the CPU
&: the ampersand at the very end of the script is what tells it to run in background

a common error is running it & (background) but forgetting nohup (no hangup) so when you logoff, it dies
Why not use screen? Or does it take up too much resources?
Reply With Quote
The Following User Says Thank You to GenericOverusedName For This Useful Post:
Reply

Bookmarks

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

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 On

Forum Jump


All times are GMT -4. The time now is 08:14 AM.


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