![]() |
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 ] |
Re: Redirect output of Linux Dominions server to logfile?
Quote:
#!/bin/bash |
Re: Redirect output of Linux Dominions server to logfile?
My script looks like this:
</font><blockquote><font size="1" face="sans-serif, arial, verdana">code:</font><hr /><pre style="font-size:x-small; font-family: monospace;"> #!/bin/bash nohup dom2 --postexec notification_IslandOfDoom --tcpserver --port 6666 --hours 48 --quickhost --noclientstart --mapfile sundering.map --textonly -ddd --statfile Island_of_Doom &> logfile & </pre><hr /></blockquote><font size="2" face="sans-serif, arial, verdana">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. |
Re: Redirect output of Linux Dominions server to logfile?
Just wanted to point out that
</font><blockquote><font size="1" face="sans-serif, arial, verdana">code:</font><hr /><pre style="font-size:x-small; font-family: monospace;"> command --flags 2>&1|tee logfile </pre><hr /></blockquote><font size="2" face="sans-serif, arial, verdana">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. </font><blockquote><font size="1" face="sans-serif, arial, verdana">code:</font><hr /><pre style="font-size:x-small; font-family: monospace;">killall -9 dom2</pre><hr /></blockquote><font size="2" face="sans-serif, arial, verdana">should work (or possibly replace dom2 with the name of your script). You can also do </font><blockquote><font size="1" face="sans-serif, arial, verdana">code:</font><hr /><pre style="font-size:x-small; font-family: monospace;">ps -e|grep dom2</pre><hr /></blockquote><font size="2" face="sans-serif, arial, verdana">to view the process id's of running scripts. Then you can subsequently kill them with </font><blockquote><font size="1" face="sans-serif, arial, verdana">code:</font><hr /><pre style="font-size:x-small; font-family: monospace;">kill -9 PROCESSID</pre><hr /></blockquote><font size="2" face="sans-serif, arial, verdana">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 |
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 ] |
All times are GMT -4. The time now is 09:25 AM. |
Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©1999 - 2025, Shrapnel Games, Inc. - All Rights Reserved.