|
|
|
|
April 18th, 2004, 11:04 PM
|
Corporal
|
|
Join Date: Jan 2004
Location: Berlin, Germany
Posts: 64
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
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 ]
|
April 18th, 2004, 11:11 PM
|
|
Shrapnel Fanatic
|
|
Join Date: Oct 2003
Location: Vacaville, CA, USA
Posts: 13,736
Thanks: 341
Thanked 479 Times in 326 Posts
|
|
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!)
|
April 18th, 2004, 11:21 PM
|
Corporal
|
|
Join Date: Jan 2004
Location: Berlin, Germany
Posts: 64
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
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.
|
April 19th, 2004, 08:27 AM
|
Corporal
|
|
Join Date: Mar 2004
Location: Copenhagen, Denmark
Posts: 54
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
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
|
April 19th, 2004, 08:56 AM
|
Corporal
|
|
Join Date: Jan 2004
Location: Berlin, Germany
Posts: 64
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
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 ]
|
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
|
|
|
|
|