| View previous topic :: View next topic |
| Author |
Message |
NewzLive Voice
Joined: 04 Jul 2007 Posts: 4
|
Posted: Mon Jul 14, 2008 9:14 pm Post subject: reading last line of logfile |
|
|
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 |
|
 |
Sir_Fz Revered One

Joined: 27 Apr 2003 Posts: 3793 Location: Lebanon
|
Posted: Tue Jul 15, 2008 7:48 am Post subject: |
|
|
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 |
|
 |
NewzLive Voice
Joined: 04 Jul 2007 Posts: 4
|
Posted: Tue Jul 15, 2008 8:52 pm Post subject: |
|
|
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 |
|
 |
nml375 Revered One
Joined: 04 Aug 2006 Posts: 2857
|
Posted: Wed Jul 16, 2008 10:09 am Post subject: |
|
|
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 |
|
 |
|