PDA

View Full Version : Linux issue?


YoChoyLaMuete
11-15-2002, 08:39 AM
We have just moved to a linux server from our former windows one, and I'm having some troubles with it... I wish to run stats on our site, but the server doesn't create the qconsole.log file. Our current cfg is as follows:

set logfile 3
set developer 1
set g_allowvote 0
seta sv_maxrate 10000
sets g_allowjointime 10
sv_allowDownload 0
sv_maxPing 0
sv_floodProtect 1
sv_pure 1
set flood_waitdelay 20
set flood_persecond 4
set flood_msgs 4
set g_teamdamage 1
rconPassword blahblahblah
set sv_privatePassword "whatever"
set admin "CEAL"
set email "ceal@cealweb.net"
set g_motd "Respeta las normas"
set g_motd2 "del servidor"
set url "http://cealweb.net"
sv_hostname "CEAL Realism: On"

fraglimit 10
timelimit 20
set roundlimit 5

sv_maplist "dm/mohdm1 dm/mohdm2 dm/mohdm3 dm/mohdm4 dm/mohdm6 dm/mohdm7 dm/SmallCity dm/tunisian_fe"
sv_privateClients 14
sv_maxclients 20
set sv_gamespy 1

g_gametype 3
set g_inactiveKick 300
set g_inactiveSpectate 60

map dm/mohdm4

I think it's technically correct, and in fact it was working fine on a Windows box and we had no problems at all with said qconsole.log - I wonder why the log is no longer being generated, maybe some linux related problem..?

Shockwave
11-15-2002, 10:53 AM
Linux doesn't have any problems generating log files, but they are stored in a different place by default. It will default to the following path and name unless it is overriden:

~/.mohaa/main/qconsole.log

You can override this by using two cvars on the command line that starts the server. Consider the following example:

+set fs_outputpath /tmp
+set logfilename server1.log

The game server will automatically append /main/ to whatever value is stored in fs_outputpath. With the settings above, the following log file will be created:

/tmp/main/qconsole.log

Specifying these settings in a server configuration file won't work due to the way the game server initially parses options. I have experimented with this in detail because the server administration tool I have been developing for Linux relies on log data to perform its functions.

If you're still having problems, let me know. :)

YoChoyLaMuete
11-15-2002, 11:27 AM
I checked our command line via SSH and it looks like this:

./mohaa_lnxded +set dedicated 2 +set sv_gamespy 1 +set net_port 12203 +set fs_basepath /home/clanceal/mohaa/ +set g_gametype 2 +set sv_maxclients 20 +map dm/mohdm1 +exec server.cfg

So our log should be located at /home/clanceal/mohaa/main, but it's not :( , maybe a permissions issue? (the app not being allowed to write to that folder or something...)

Thanks for your help,

YoChoy

Shockwave
11-15-2002, 11:35 AM
I believe that fs_basepath and fs_outputpath are two separate things. Login as the user who starts the game server and issue this command:

ls -l ~/.mohaa/main

See if anything is there.

YoChoyLaMuete
11-15-2002, 11:50 AM
That's what I did:

rcon fs_outputpath: returns /home/clanceal/.mohaa
rcon fs_basepath: returns /home/clanceal/mohaa

Tried your line on SSH and...

-rw-r--r-- 1 clanceal clanceal 252146 Nov 15 16:56 qconsole.log

Woohoo!! I've no idea on *nix systems, but that looks promising...

I'm sorry to bug you with this question, but so far, nobody answers on the provider forum...

Thanks again

Shockwave
11-15-2002, 11:58 AM
There is a subtle difference between the two variables you displayed. The fs_basepath points to a public directory called mohaa and the fs_outputpath points to a "hidden" directory called .mohaa. The "." means that the directory won't be shown in a regular listing. To show all the hidden files and directories you need to specify an additional argument. Try this:

ls -al ~

The above command will show you all the entries in your home directory, whether they are hidden or not. You'll then be able to see the two separate directories to which each of the cvars refer.

BTW, you're not bugging me. I'm glad I could help. :)

YoChoyLaMuete
11-15-2002, 12:13 PM
Ok, then I final question :D

What I want to do is accessing the server via ftp, download the log to process it locally, and then maybe delete it via ftp too (I think it's possible, since I've been able to delete via ftp mods that were running on the server without having to stop it). Can I access those hidden directories via ftp (like CWD .mohaa/main)? I tried it on my win ftp and it executed the command, though the directory contents were not shown. Unfortunately, I can't try to download it right now since jolt ask you not to transfer file on peak times.

Thank you very, very much!

Shockwave
11-15-2002, 12:37 PM
First, I would recommend that you don't mess with the log file while the server is running because weird things happen. I recommend that you do the following in the script file that starts your game server:


# save last copy of log file
cp ~/.mohaa/main/qconsole.log ~/.mohaa/main/qconsole_last.log

# truncate log
> ~/.mohaa/main/qconsole.log


Next, I recommend that you compress the log file prior to transferring it. The redundant nature of the content makes it highly compressable (I've seen an 18:1 ratio). You can compress it like this:

gzip ~/.mohaa/main/qconsole_last.log

This will make a file called qconsole_last.log.gz that WinZip can decompress easily.

Finally, I wouldn't bother with FTP when scp (secure copy) is available. It uses the same encryption scheme as SSH and you can download a freeware utility to use it. I am a huge fan of PuTTY and its companion application, pscp, is what I use to scp files from my Linux servers to my windows stations. Here's a link to where you can get both programs:

http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html

I made a shortcut that invokes pcsp and transfers the target file to a subdirectory on one of my Windows PC's. Here's an example of how you would set up the command line for the shortcut:

C:\apps\pscp.exe uname@sitename.com:/home/username/.mohaa/main/qconsole_last.log.gz C:\logs

Just substitute the proper information specific to your system and this will work like a charm.

YoChoyLaMuete
11-15-2002, 01:13 PM
Uffff... I have some problems with this, I will keep posting here cause other admins new to linux may find it useful.

I know PuTTY, that's what I'm using so far. But I don't know how to issue the needed commands in an unattended manner (cp ~/.mohaa/main/qconsole.log ~/.mohaa/main/qconsole_last.log and ~/.mohaa/main/qconsole.log). I could use the task scheduler and command line utility (Plink), but I checked the documentation and it asked me to generate a public key, then setup the server to use it... I don't know even if I'm allowed by Jolt to do that. That's why I thought of just deleting the old log. The other option was closing the server via a scheduled rcon quit; it will reset the log, but I can't restart it again without SSH...

Same thing about PSCP, I guess it will also require authentication (of course ;) )

No problems using gzip, however I think my host is more concerned about processor time than bandwith (I would schedule the download at 6:00 AM or so), so not sure If I'll use it but now I know how to do it, thanks!!

So basically my problem is now: how to schedule a SSH session? I can write a VB proggie to send keystrokes to PuTTY, but it just doesn't look as the right way...

Uffff... I'm dying to have our new Uber Lite Windows based (not that I don't like linux, is just that I'm too new to it :( )

Did I said thank you????

YoChoy

Shockwave
11-15-2002, 02:08 PM
If you are trying to automate the whole process, there are a bunch of things you can do. First, I would take a look at Dogmeat's Linux restart script under the Guides section of this site:

http://mohadmin.com/nuke/modules.php?name=Content&pa=showpage&pid=21

It gives you the basic script for making sure that a server will always restart if it dies. This is a simple and basic solution to your remote rcon quit idea. Start the server with these scripts and schedule the server quit command whenever you want it to happen.

Next, you can add a couple of the lines I mentioned in my previous post to the script before it restarts the server in order to backup the log file, gzip it, and truncate the existing log:


# save last copy of log file
cp ~/.mohaa/main/qconsole.log ~/.mohaa/main/qconsole_last.log

# truncate log
> ~/.mohaa/main/qconsole.log

# compress backup log
gzip ~/.mohaa/main/qconsole_last.log


The only worry you have now is automatically sending the log file to a remote destination if you don't want to have to do it manually. The answer will depend upon the resources you have available. If you have a remote FTP server and FTP is running on the game server, you can create a .netrc script and have it execute commands to send the file to the remote FTP server. If sendmail is running on the game server, you could use a Perl script to mail the compressed log file. Yet another option is to use pscp but feed it from a file containing your password like this:

C:\apps\pscp.exe uname@sitename.com:/home/username/.mohaa/main/qconsole_last.log.gz C:\logs < C:\apps\pwd.txt

You would have to create a C:\apps\pwd.txt file that has the password you want to use inside of it. After entering your password in the file, be sure to press the <Enter> key to move to the next line. This works by feeding the pscp program input from the file to the right of the < sign. You can think of it as a macro. Of course, this isn't the most secure option, even if you make the file hidden and read-only, but it works.

If you can give me some more details about what resources are available to you, I'm sure we can get something working.

YoChoyLaMuete
11-20-2002, 04:34 AM
Bad luck!!!

Asked them about DM script:

I'm afraid not.
Reason being if a process hangs it will not restart and using such a script would cause problems if that happens.

If the server stops completely then that script would work, but seeing as a lot of procs on linux go 99% cpu and hang its not such a great idea.

Jolt dixit...

The only access I've to our server is ftp to upload/delete mods, webadmin to start/stop the server (but starting doesn't work either) and SSH for the same purpose. I'm about to forget about stats, maybe when we move to an uber lite (dedicate box, win OS) we could get them back again... sigh!

Regards,

YoChoy

Shockwave
11-20-2002, 08:30 AM
I take exception with the gentleman's argument:

...but seeing as a lot of procs on linux go 99% cpu and hang...

The game server is the only process you are really running here and I have never seen it do anything like this. The surrounding restart script simply automates launching the game server process and doesn't perform any other actions that would even come close to doing what this individual fears may happen. If he really means what he says then he is actually contradicting himself by letting you run the game server at all because that would be the process that would hang!

Regardless, there is more than one way to tackle this problem. If you don't mind manually restarting the game server if it crashes, then it's possible you can email yourself automatically if the server crashes. To test if this will work, edit a text file named something like test on the game server and put a line of text in it:

This is a test message.

Save the file, then issue this command at the system prompt:

mail yourname@yoursite.com < test

Of course, you'll need to substitute your actual email address for the bogus one I've used in the example. If everything works, you should receive the message in your email. You just have to add this line to the script that contains the server launch command line. This wouldn't cause an endless loop and doesn't have any chance of eating system resources so it should be OK to use.

Regarding stats, tell me what the problem is. Maybe we can find a way to handle it.

YoChoyLaMuete
11-26-2002, 04:24 AM
Hi Shockwave,

Not that I forgot about the stats thing, but I was doing it "by hand" (is that correct?) until our server moves to Windows.

However I have just thought of a different way to automate the process:

1.- Set logfile 0
2.- Download the logfile
3.- Delete log (via ftp)
4.- Set logfile 1

This can be easily scheduled and doesn't involve dealing with SSh in any way. Since the server stops logging while the file is deleted, it should be safe to do so. What do you think about it?

Regards,

YoChoy

Shockwave
11-27-2002, 12:48 PM
You can do that, but I would recommend that you not delete the existing log file. If you do, something strange happens and subsequent game server data will not be logged even after you turn logging on again. The game server must lose it's link to the file somehow. If you copy a blank file over the top of the log while logging is disabled, you can accomplish the same thing, with one side-effect. The top of the log file will be filled with a few hex(00)'s when logging resumes. Assuming this isn't a problem, you should be OK.

YoChoyLaMuete
11-27-2002, 12:54 PM
Then I think we (you) sorted it out!!!

No problem on overwriting the previous log (that can be scheduled so easy... :D ), and the hex codes are no problem also (I'm sure, I wrote my own parser for that ;) ).

Thank you very, very much!! We can have our stats back (and forget about manual updates...)

Regards,

YoChoy