.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 2: The Ascension Wars

Reply
 
Thread Tools Display Modes
  #1  
Old April 18th, 2004, 11:04 PM

BugRoger BugRoger is offline
Corporal
 
Join Date: Jan 2004
Location: Berlin, Germany
Posts: 64
Thanks: 0
Thanked 0 Times in 0 Posts
BugRoger is on a distinguished road
Default Redirect output of Linux Dominions server to logfile?

Hello Everybody,

now that the battle replay bug has been fixed I'm trying to set up my linux game server. I wrote some scripts for automatic turn notification and everything works pretty well.

I got a little problem with catching the output of the server process though. Some time ago Gandalf wrote that it's now possible to catch the output but I can't get it to work.

I currently start the server like that:
nohup dom2 --lotofparameters > logfile 2>> error &

Tried a billion different redirections as well. It doesn't seem like I now what I'm doing. It just doesn't work.

Any ideas?


Rock on,

Michael

[ April 18, 2004, 22:07: Message edited by: BugRoger ]
Reply With Quote
  #2  
Old April 18th, 2004, 11:11 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: Redirect output of Linux Dominions server to logfile?

Quote:
Originally posted by BugRoger:
I got a little problem with catching the output of the server process though. Some time ago Gandalf wrote that it's now possible to catch the output but I can't get it to work.

I currently start the server like that:
nohup dom2 --lotofparameters > logfile 2>> error &
Looks about right to me. Are you using the -T switch so everything comes out as plain text? Does the script have a specific shell specified? I usually run mine with the first line as...
#!/bin/bash
__________________
-- 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!)
Reply With Quote
  #3  
Old April 18th, 2004, 11:21 PM

BugRoger BugRoger is offline
Corporal
 
Join Date: Jan 2004
Location: Berlin, Germany
Posts: 64
Thanks: 0
Thanked 0 Times in 0 Posts
BugRoger is on a distinguished road
Default Re: Redirect output of Linux Dominions server to logfile?

My script looks like this:
code:
 
#!/bin/bash

nohup dom2 --postexec notification_IslandOfDoom --tcpserver --port 6666 --hours 48 --quickhost --noclientstart --mapfile sundering.map --textonly -ddd --statfile Island_of_Doom &> logfile &

So I guess the -T switch is set. I have the feeling that my problem is that I just kill the dom server and it dies before flushing the output to the file.

How does one stop the dom server properly? Especially when it is running in the background.
Reply With Quote
  #4  
Old April 19th, 2004, 08:27 AM

guybrush threepwood guybrush threepwood is offline
Corporal
 
Join Date: Mar 2004
Location: Copenhagen, Denmark
Posts: 54
Thanks: 0
Thanked 0 Times in 0 Posts
guybrush threepwood is on a distinguished road
Default Re: Redirect output of Linux Dominions server to logfile?

Just wanted to point out that

code:
 command --flags 2>&1|tee logfile  

Will put everything in the logfile, but still put it in your terminal also. I often find this quite handy.

If you want it to go in the background, then you could of course do what you already proposed, but you could also prepend the above command with "screen". You can then exit from the command running in screen by ctrl-A D, and resume by "screen -r" (or "screen -r 5432" to select process 5432 if there is more than one). "screen" is one of the most useful and overlooked programs in linux.

On the topic of killing processes in the background.
code:
killall -9 dom2

should work (or possibly replace dom2 with the name of your script).

You can also do
code:
ps -e|grep dom2

to view the process id's of running scripts. Then you can subsequently kill them with
code:
kill -9 PROCESSID

The "-9" kills the process outright, no questions asked. To be a bit more gentle you could use the commands without "-9" first and see if thats enough.

Cheers,
Thomas
Reply With Quote
  #5  
Old April 19th, 2004, 08:56 AM

BugRoger BugRoger is offline
Corporal
 
Join Date: Jan 2004
Location: Berlin, Germany
Posts: 64
Thanks: 0
Thanked 0 Times in 0 Posts
BugRoger is on a distinguished road
Default Re: Redirect output of Linux Dominions server to logfile?

Thanks for the replies. I appreciate your help.

I already played with the tee command but that doesn't work either. Dominions is behaving funky in server mode...

Even if I just call it from the cmdline with:
dom2 -bunchOfParameters | cat
the output is lost.

But if I run:
dom2 --help 2>&1| tee logfile
it runs perfectly fine.

Hmm. I don't know. It should work. Is this really working for you guys? Then there's probably something wrong with my system.

I already heard about the screen command and will look into it tonight. I would prefer to read a logfile but this might be better than no log at all...

[ April 19, 2004, 07:58: Message edited by: BugRoger ]
Reply With Quote
Reply

Bookmarks

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 05:37 AM.


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