egghelp.org community Forum Index
[ egghelp.org home | forum home ]
egghelp.org community
Discussion of eggdrop bots, shell accounts and tcl scripts.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

reading last line of logfile

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help
View previous topic :: View next topic  
Author Message
NewzLive
Voice


Joined: 04 Jul 2007
Posts: 4

PostPosted: Mon Jul 14, 2008 9:14 pm    Post subject: reading last line of logfile Reply with quote

Hi there - I'm occasianally getting error messages to do with reading web pages and the only way to resolve it is to kill/restart the bot.
I'm wondering if there's a way to read the last line of the eggdrop.log file every few minutes, and if it detects this:

couldn't open socket: host is unreachable

then kill the bot?

Thanks in advance.
Back to top
View user's profile Send private message
Sir_Fz
Revered One


Joined: 27 Apr 2003
Posts: 3793
Location: Lebanon

PostPosted: Tue Jul 15, 2008 7:48 am    Post subject: Reply with quote

That's the worst way for solving this problem. Obviously, this is not a normal behavior for the bot. You should try to fix the script which is causing the problem.
_________________
Follow me on GitHub

- Opposing

Public Tcl scripts
Back to top
View user's profile Send private message Visit poster's website
NewzLive
Voice


Joined: 04 Jul 2007
Posts: 4

PostPosted: Tue Jul 15, 2008 8:52 pm    Post subject: Reply with quote

it's not the script - its just the website sometimes causes it to do that.
but thanks for the useless reply anyway.
Back to top
View user's profile Send private message
nml375
Revered One


Joined: 04 Aug 2006
Posts: 2857

PostPosted: Wed Jul 16, 2008 10:09 am    Post subject: Reply with quote

I think what Sir_Fz was referring to, was to write a script that is capable of recovering from an unreachable host by itself, rather than requiring your whole bot to be restarted...

As for your question, run a crontab with a simple bash-script, something like this:
Code:
if test ` tail -n 1 somelog | grep "couldn't open socket: host is unreachable -c` -ne 0
 then kill -9 `cat pidfile`
 ./configfile
fi

(Modified from a script I used to track apache-logs, might need further modifications...)

Of course, this is only one way of doing it with bashscripts, you could probably write something equivalent in tcl, perl, C, etc
_________________
NML_375, idling at #eggdrop@IrcNET
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help All times are GMT - 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Forum hosting provided by Reverse.net

Powered by phpBB © 2001, 2005 phpBB Group
subGreen style by ktauber