Anope IRC Services
Anope.org => Anope General => Topic started by: scarcorp on February 18, 2008, 12:22:51 AM
-
My IRC server & Anope works like a charm, great job people :)
The only thing is this:
After the server & services have been running for a few days I get this Notice:
*** Notice -- Link [@127.0.0.1.57085] cancelled, server
services.scarcorp.com.au already exists from services.scarcorp.com.au
And it comes up every 5 minutes, which incidentally is the contrab time check I've setup.
I've looked at the contrab, the services set up etc, but can't figure it out.
Has anyone else come across this problem?
It's not terribly important since everything else works fine, but being a bit of a perfectionist I like things to run as expected hehe
Cheers,
Johnny
-
You might set up crontab for anope not properly.
-
Thanks for your reply,
This is my crontab:
0,5,10,15,20,25,30,35,40,45,50,55 * * * * /home/ircadmin/services/services.chk >/dev/null 2>&1
And this is services.chk:
#!/bin/sh
# Crontab script for Anope
#
# To know how to install the crontab, read the INSTALL file.
###############################################################
# CONFIGURATION
###############################################################
# Anope binary directory
ANOPATH=/home/ircadmin/services/
# Name of the pid file
ANOPIDF=services.pid
# Name of the executable
ANOPROG=services
# Parameters to pass to the executable
ANOARGS=""
#ANOARGS="-debug"
###############################################################
# DON'T EDIT ANYTHING BELOW #
###############################################################
PATH=/bin:/usr/bin:/usr/local/bin
ANOPID=
cd $ANOPATH
if [ -f $ANOPIDF ]
then
ANOPID=`cat $ANOPIDF`
if [ `ps auwx | grep $ANOPROG | grep $ANOPID | grep -v -c grep` = 1 ]
then
exit
fi
rm -f $ANOPIDF
fi
./$ANOPROG $ANOARGS
I have it set up to run under it's own user: ircadmin
If you see anything incorrect, I'd appreciate it if would point it to me. I'm quite a novice at this.
Thanks again,
Johnny
-
only 2 things that cause an auto-connect attempt and that's crontab and an auto-connect entry in your link block.
-
Ok ... Thanks ... Funny thing is it's ok for a few days ... then it tries to connect every 5 mins ... although the service is already running & operating as expected.
Cheers,
Johnny
-
yeah.. i have experienced and seen this with others before... for some reason the services.pid file disappears and then the cronjob thinks anope isn't running anymore and tries to start a new instance... which is then rejected by the ircd of course.
A quick fix is to recreate the services.pid with anopes pid in it, but that won't prevent it from happening again...
-
Maybe I'll try creating a copy of the pid file and add a crontab to check for it's existence, then have it copied.
We'll see
:)
-
No didn't work ... It's a mistery ... everthing seems setup up ok!
-
Oh well, apart from a bit of extra CPU processing time, it's not a real drama.
If anyone has experienced this before, or know of a solution, your thoughts would be welcome.
I wonder if it has anything to do with crontab itself? That's a little out of my depth lol
Thanks all.
:)
[Edited on 19-2-08 by scarcorp]
-
Actually now that I think about it. It's been reported in the past that some users that use the anope's example.chk cron script found that their pid files get deleted at the wrong times. This is an occasional occurance adn without that pid file the check script will attept to start Anope, even if it's running.
Personally I use a custom script and haven't had such bad luck.
-
Problem solved!
I simply added a crontab entry to copy a backup of services.pid and after a few days it seems to be ok.
Many thanks for everyone who helped :)
Cheers,
Johnny
:)
-
Back to square one again!
I've done away with services.chk there seems to be an error in the script, I'm no expert at writing scripts, but it seems the script's logic deletes the services.chk file, and then runs ./services again.
if [ -f $ANOPIDF ] <------ this checks if services.pid exists
then
ANOPID=`cat $ANOPIDF` <--------- if does it gets the pid number
if [ `ps auwx | grep $ANOPROG | grep $ANOPID | grep -v -c grep` = 1 ] <------- this checks if the service is running
then
exit <--------- yes it is running so it exits the script.
fi
rm -f $ANOPIDF <------- no it's not, so it deletes the pid file
fi
./$ANOPROG $ANOARGS <-------- starts services again.
Problem is for some reason the script deletes the pid file and then on it's next check it tries to run services even though its already running!
Oh well...
Cheerrs.
-
The problem is known... what isn't known is what causes it, since it is only a small minority of people that ever experience this problem, and even then it doesn't always happen again...
-
several people tend to use a modified version of the chk script that comes with UnrealIRCd and have better luck.
-
Would someone care to supply me with one of their modified scripts?
Johnny
-
?? .. user the one that come with Unreal and put anopes name in it .. it's not that hard.
-
katsklaw, could you post your .chk file maybe? Im having this problem too, cant get it fixed.
Thanks
-
Originally posted by TommyGun
katsklaw, could you post your .chk file maybe? Im having this problem too, cant get it fixed.
Thanks
What IRCd do you use?
-
I noticed that I had crontabs setup as root as well as "ircadmin", after sorting that out and just using the ircdchk & crontab under owner "ircadmin" the problem has resolved itself.
<well - I am rather new at all this but its fun!>
Cheers everyone.:)
-
Originally posted by katsklaw
Originally posted by TommyGun
katsklaw, could you post your .chk file maybe? Im having this problem too, cant get it fixed.
Thanks
What IRCd do you use?
UnrealIRCD
-
then you need to use the Unreal .chk file like I already suggested. It's not hard to edit for Anope.
-
I know, but im not really sure about the edits. Is this correct?
#!/bin/sh
# The path to the services binary
ircdexe="/home/tommygun/services"
# The path to the services pid file
ircdname="/home/tommygun/services/services.pid"
########## you probably don't need to change anything below here ##########
if test -r $ircdname; then
# there is a pid file -- is it current?
ircdpid=`cat $ircdname`
if `kill -CHLD $ircdpid >/dev/null 2>&1`; then
# it's still going
# back out quietly
exit 0
fi
echo "Anope Crontab notice:"
echo ""
echo "Stale $ircdname file (erasing it)"
rm -f $ircdname
fi
echo ""
echo "Couldn't find services running. Reloading it..."
echo ""
$ircdexe
-
TommyGun, for ircdexe it should be /home/tommygun/services/services assuming youre in /home/tommygun/services when you type ./services
-
Ah right, thanks. And how to get the pid back? Because now;
bash-3.00$ /home/tommygun/services/services.chk
Couldn't find services running. Reloading it...
IRC: [18:19] -irc.gamergun.com- *** Notice -- Link [@127.0.0.1.51132] cancelled, server services.gamergun.com already exists from services.gamergun.com
-
kill services then start services
-
Seems to work now... hope it will stay that way, lol
Thanks guys
-
An unrealircd crontab script isnt as good as it could be thought.
i.e., if an operation system fails for some reason, and goes for reboot, pidfile isnt erased and if some process during startup will retake the same PID as services had before, then services would not start at all.
In that script only existance of the PID listed in services.pid is checked, and no check is done upon what process do that PID has.
This is really possible when services right before the system fail were started at system boot, so they have low numbers in PID.
-
So... you can write another script? ;)