LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 01-14-2006, 03:45 PM   #1
jetpig
LQ Newbie
 
Registered: Oct 2005
Posts: 20

Rep: Reputation: 0
odd error


i've got an odd error in my messages log. this is from a user running a script to check if his mud is looping or if it's dead and restarts it. well everytime it checks and is just fine it tosses this error:

Jan 14 13:36:14 yggdrasil in.identd[18531]: reply to 127.0.0.1: 34336 , 8000 : ERROR: UNKNOWN-ERROR

i'd like this to go away as that's rather spamtastic. this is on a slack 10.2.

script source:
Code:
#!/usr/bin/perl
#########################################################################
# Small Mod made by me to use my startup script, so my logs stay as i   #
# have them -- So my log cleaner/compresser works without mods --GW     #
# PLEASE GO TO THE LAST LINE OF THE FILE, AND CHANGE WHERE IT SAYS TO!! #
#########################################################################
# mudcheck.pl                           Version 1.0                     #
# Created: Jun 28, 1997                 Jared Proudfoot                 #
# Last Modified: Jun 28, 1997           jproudfo@footprints.net         #
#########################################################################
# README                                                                #
#                                                                       #
# This is a pretty simple script that checks to see if a mud is running #
# properly.  Be sure to change the 'important vars' section.  The best  #
# idea is to run this script from cron every couple of minutes... That  #
# way you can be sure that it stays running.                            #
#########################################################################
# CHANGES AND HISTORY                                                   #
#                                                                       #
# v 1.0, Jun 28, 1997   Created.  Seems to work fine now.               #
#########################################################################
#########################################################################
# Define the important vars                                             #
#                                                                       #
# Define the host and port number where the mud resides.                #
#here
$server         =       "localhost";
$port           =       "8000";

# $string is the string of characters we will look for upon connecting. #
# If we connect, but don't see this string, we will assume the mud      #
# isn't responding (locked up?) and we'll restart it.  The string       #
# *must* be on the first line after connect.

# You may enter this as a regexp if you wish.                           #

$replyString            =       "^\n";

# How long do we wait before we connect timeout (in seconds)?           #

$timeOut        =       "60";

# What to execute if we need to restart the mud.  Please include the    #
# FULL path.                                                            #
#here
$exec           =       "~/pr/src/pr";

# Path where you want the mud logs to be kept.
#here
$logdir         =       "~/pr/log";
#here
# Path where we should start the mud from.                              #
$startPath      =       "~/pr/area";

# That's it.  You shouldn't need to change anything after this line.    #
#########################################################################

# What do we need to use?
use Socket;
require 5.003;

#########################################################################
# Main                                                                  #
#########################################################################

if (&connect_server == 0) {
        # If we couldn't connect, try and restart.                      #
        print ("Connection to $server on port $port failed or timed out after $timeOut seconds!\n");
        $time = (scalar localtime);
        print ("Attempting to restart the mud on $time...\n");
        # Restart the mud                                               #
        &restart_mud;
}
else {
        # We connected, but is it working properly?                     #
                $readline = (&gl);
                if ($readline =~ /$replyString/) {
                        # We found what we were looking for, so exit    #
                        # properly.                                     #
                        &disconnect_server;
                        exit 1;
                }
        # After all those searches, we didn't find anything.  The mud   #
        # must be locked up.  Lets kill and restart it.                 #
        &disconnect_server;
        print ("The connection was sucessful, but it doesn't seem to be responding\n");
        $time = (scalar localtime);
        print ("Attempting to restart the mud on $time...\n");
        system("killall $exec");
        &restart_mud;
}



#########################################################################
# Subroutines                                                           #
#########################################################################


sub connect_server {
        # Connect to the server                                         #
        my ($iaddr, $paddr, $proto);
        $iaddr = inet_aton ($server)
                or die ("ERROR: No host: $server!\n");
        $paddr = sockaddr_in ($port, $iaddr);
        $proto = getprotobyname('tcp');
        socket (SOCK, PF_INET, SOCK_STREAM, $proto)
                or die ("ERROR: Socket error $!\n");
        alarm ($timeOut);
        if (connect (SOCK, $paddr)) {;
                alarm (0);
                return 1;
        }
        else {
                return 0;
        }
}

sub disconnect_server {
        # Disconnect from the server                                    #
        close (SOCK);
        return;
}

sub sl {
        # Send a line                                                   #
        my ($line)=@_;
        print SOCK ("$line")
                or die ("ERROR: Error writing to server: $!\n");
        select SOCK;
        $|=1;
        select STDOUT;
        $|=1;
        return;
}

sub gl {
        # Get a line                                                    #
        my ($buffer, @reply);
        $buffer=(<SOCK>);
#       (@reply) = split (/\s/, $buffer);
#       return (@reply);
        return ($buffer);
}

sub restart_mud {
                # Restart the mud                                       #
                $timet = time();
                chdir $startPath;
#here
                system ("~/pr/src/startxanth &");
                return;
}
any help is appreciated.
 
  


Reply



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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
gentoo + odd error message kurrupt Linux - Software 2 12-07-2005 06:43 PM
odd Apache 404 error Seventh Linux - Software 1 03-27-2005 03:43 AM
Wine and DIablo 2, odd error Reefcrazed Linux - Games 3 07-27-2004 12:29 PM
Odd error installing ffmpeg af_dave Linux - Software 1 07-12-2004 02:01 AM
Odd error during boot up, never seen this before [42]Sanf0rd Linux - General 2 06-26-2004 05:42 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 06:06 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration