1
0
mirror of https://github.com/anope/anope.git synced 2026-07-05 17:43:13 +02:00

Fixed up anoperc to work with the newer startup method

This commit is contained in:
Adam
2011-10-15 02:08:52 -04:00
parent 89b4be681d
commit 2c614d5aab
2 changed files with 44 additions and 46 deletions
+40 -44
View File
@@ -17,20 +17,20 @@
ANOPEPID="@INSTDIR@/data/services.pid"
ANOPROG="@INSTDIR@/bin/services"
LOG="@INSTDIR@/data/logs/"
ARCVERSION="1.3"
ARCVERSION="1.4"
isAnopeRunning () {
if [ ! -f $ANOPEPID ] ; then
echo "Warning: Anope is not currently running"
exit 1
fi
if [ ! -f $ANOPEPID ] ; then
echo "Warning: Anope is not currently running"
exit 1
fi
PID=`cat $ANOPEPID`
PID=`cat $ANOPEPID`
if [ ! `ps auxw | grep $ANOPROG | grep $PID | grep -v -c grep` ] ; then
echo "Warning: Anope is not currently running"
exit 1
fi
if [ ! `ps auxw | grep $ANOPROG | grep $PID | grep -v -c grep` ] ; then
echo "Warning: Anope is not currently running"
exit 1
fi
}
if [ ! -f $ANOPROG ] ; then
@@ -38,44 +38,35 @@ if [ ! -f $ANOPROG ] ; then
exit 1
fi
if [ "$UID" = "0" ] ; then
echo "######################################";
echo "# Warning: Do NOT run Anope as root! #";
echo "######################################";
exit 1
echo "######################################";
echo "# Warning: Do NOT run Anope as root! #";
echo "######################################";
exit 1
fi
if [ "$1" = "start" ] ; then
if [ -f $ANOPEPID ] ; then
PID=`cat $ANOPEPID`
if [ `ps auxw | grep $ANOPROG | grep $PID | grep -v -c grep` = 1 ] ; then
echo "Warning! Anope is already running"
exit 1
if [ -f $ANOPEPID ] ; then
PID=`cat $ANOPEPID`
if [ `ps auxw | grep $ANOPROG | grep $PID | grep -v -c grep` = 1 ] ; then
echo "Warning! Anope is already running"
exit 1
fi
fi
fi
echo "Starting Anope"
shift
$ANOPROG $*
sleep 1
if [ ! -f $ANOPEPID ] ; then
if [ "$?" -ne "0" ] ; then
echo ""
echo "Unfortunately it seems Anope did not start successfully"
echo "This error has been logged in your Anope Log file"
echo "Located in "$LOG""
echo "This may help you diagnose the problem"
echo "Further help may be available from http://www.anope.org/"
exit 1
fi
PID=`cat $ANOPEPID`
if [ ! `ps auxw | grep $ANOPROG | grep $PID | grep -v -c grep` ] ; then
echo "Unfortunately it seems Anope did not start successfully"
echo "This error has been logged in your Anope Log file"
echo "Located in "$LOG""
echo "This may help you diagnose the problem"
echo "Further help may be available from http://www.anope.org/"
exit 1
fi
fi
elif [ "$1" = "stop" ] ; then
isAnopeRunning
@@ -87,7 +78,7 @@ elif [ "$1" = "status" ] ; then
PID=`cat $ANOPEPID`
if [ `ps auxw | grep $PID | grep -v -c grep` = 1 ] ; then
echo "Anope is currently running"
exit 1
exit 0
fi
fi
@@ -98,9 +89,20 @@ elif [ "$1" = "restart" ] ; then
echo "Restarting Anope"
kill -15 `cat $ANOPEPID`
sleep 1
shift
$ANOPROG $*
if [ "$?" -ne "0" ] ; then
echo ""
echo "Unfortunately it seems Anope did not start successfully"
echo "This error has been logged in your Anope Log file"
echo "Located in "$LOG""
echo "This may help you diagnose the problem"
echo "Further help may be available from http://www.anope.org/"
exit 1
fi
elif [ "$1" = "rehash" ] ; then
isAnopeRunning
echo "Saving Databases and Rehashing Configuration"
@@ -112,19 +114,13 @@ elif [ "$1" = "version" ] ; then
elif [ "$1" = "help" ] ; then
if [ "$2" = "paramlist" ] ; then
$ANOPROG -help
else
else
echo "AnopeRC is a remote control script for easy"
echo "controlling of Anope from the command console"
echo "$0 start Start Anope"
echo " Additional parameters may be passed"
echo " (e.g. $0 start -nofork)"
echo " For a list type $0 $1 paramlist"
echo "$0 start Start Anope."
echo "$0 stop Shutdown Anope"
echo "$0 status Show Anope's Status"
echo "$0 restart Restart Anope (Databases will be saved)"
echo " Additional parameters may be passed"
echo " (e.g. $0 restart -logchan)"
echo " For a list type $0 $1 paramlist"
echo "$0 restart Restart Anope (Databases will be saved)."
echo "$0 rehash Rehash Configuration and Save Databases"
echo "$0 version Return Anope Version and Build Information"
echo "$0 help Show this help menu"
+4 -2
View File
@@ -267,9 +267,11 @@ class SignalSigChld : public Signal
void OnNotify()
{
int status = 0;
int status = 0, ret = -1;
wait(&status);
exit(status);
if (WIFEXITED(status))
ret = WEXITSTATUS(status);
exit(ret);
}
};
#endif