|
|
|
|
|
May 5th, 2010, 11:34 AM
|
|
Shrapnel Fanatic
|
|
Join Date: Oct 2003
Location: Vacaville, CA, USA
Posts: 13,736
Thanks: 341
Thanked 479 Times in 326 Posts
|
|
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.
|
May 5th, 2010, 12:24 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
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
|
July 16th, 2010, 12:48 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
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.
|
October 16th, 2010, 04: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
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.
|
October 22nd, 2010, 06:56 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
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..
|
September 10th, 2011, 02:38 PM
|
Private
|
|
Join Date: May 2010
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
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?
|
September 10th, 2011, 02:53 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
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
|
September 14th, 2011, 05:20 PM
|
Second Lieutenant
|
|
Join Date: Aug 2010
Posts: 546
Thanks: 100
Thanked 10 Times in 8 Posts
|
|
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?
|
July 1st, 2012, 12:25 PM
|
Private
|
|
Join Date: Mar 2012
Posts: 2
Thanks: 0
Thanked 1 Time in 1 Post
|
|
Re: Linux Admining
Quote:
Originally Posted by Gandalf Parker
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?
|
The Following User Says Thank You to GenericOverusedName For This Useful Post:
|
|
July 1st, 2012, 12:31 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
Up to you. My server runs many things including 2 online worlds. And I have up to 100 Dom3 games on my server at a time. I dont really have much of a need to access them directly.
But of course for people managing fewer games at a time then screen might be a good idea.
|
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
|
|
|
|
|