First Linux Post

I downloaded the LogJam LiveJournal client for Linux. There was even pre-compiled binaries for Fedora Core 3. Started right up! I use Semagic for my Windows client. Semagic is a little more feature rich than LogJam. LogJam seems perfectly capable though. One noticeable problem, no spell check in LogJam. Eeek!

I have been doing another Linux related project. I came up with a flexible check script for a game server. This script will not only notify you when your server crashes, but will also notify if the server “hangs”. My definitions: A crash means the server process is no more. A hang means that the server process is still listed and taking up resources, just that the server is unresponsive. I commented out some lines in the script that actually restarted the game server once it took it down. The lines of code work, just that you won’t have console input/ouput because the script starts the server in the background.

One catch in this script is that you must install qstat for it to work. The script uses qstat to “ping” the server. You will need a working knowledge of qstat to get this script up and running.

#! /bin/sh

serv_arg="-console -game cstrike +maxplayers 7 +map de_dust +log on"

while [ 1 ]; do

$qstat $qstat_arg $serv_ip:$serv_port > $tf1
greptest=`grep "no response" $tf1`
if [ "$greptest" == "" ]; then
	greptest=`grep "DOWN" $tf1`

# echo "$greptest"
if [ "$greptest" != "" ]; then
	echo "One _no response_ at "$(date +%c)".  Will test again in 20 seconds"
	# test again in case switching maps or something similar.
	sleep 20
	$qstat $qstat_arg $serv_ip:$serv_port > $tf1
	greptest=`grep "no response" $tf1 `
	if [ "$greptest" == "" ]; then
		greptest=`grep "DOWN" $tf1`

	if [ "$greptest" != "" ]; then
		echo "Killing process at :"$(date +%c)
		/sbin/fuser -k $serv_path$serv_name
		sleep 10
#	The following lines start the server, but you will not have console access.
#       Best to start the server manually in another xterm.
#		echo "Starting server at :"$(date +%c)
#		cd $serv_path
#		./$serv_name $serv_arg &
		if [ $user_to_mail != "" ]; then
			echo "Your POS server went down at "$(date +%c) | mail -s "$serv_name failed" $user_to_mail

echo "Server pinged by script at "$(date +%c)
sleep 40


Leave a Reply

Your email address will not be published. Required fields are marked *