summaryrefslogtreecommitdiff
path: root/src/bin
diff options
context:
space:
mode:
authorAdam <Adam@anope.org>2011-10-15 02:08:52 -0400
committerAdam <Adam@anope.org>2011-10-15 02:08:52 -0400
commit2c614d5aabc787c0054bdcc813001dabb3e4b0d4 (patch)
treedf18f9c534aa93c5ae7c3ae3533249e6cec2246e /src/bin
parent89b4be681de8c9242abbe05c499a1426290d947c (diff)
Fixed up anoperc to work with the newer startup method
Diffstat (limited to 'src/bin')
-rw-r--r--src/bin/anoperc.in84
1 files changed, 40 insertions, 44 deletions
diff --git a/src/bin/anoperc.in b/src/bin/anoperc.in
index 8440a3c13..5dce8b5ef 100644
--- a/src/bin/anoperc.in
+++ b/src/bin/anoperc.in
@@ -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"