anope- supernets anope source code & configuration |
git clone git://git.acid.vegas/anope.git |
Log | Files | Refs | Archive | README |
anoperc.in (3416B)
1 #!/bin/sh 2 # 3 # Configuration script for Services 4 # 5 # (C) 2003-2022 Anope Team 6 # Contact us at team@anope.org 7 # 8 # Please read COPYING and README for further details. 9 # 10 # Based on the original code of Epona by Lara. 11 # Based on the original code of Services by Andy Church. 12 # 13 # 14 15 16 17 ANOPEPID="@INSTDIR@/data/services.pid" 18 ANOPROG="@INSTDIR@/bin/services" 19 LOG="@INSTDIR@/logs/" 20 ARCVERSION="2" 21 22 isAnopeRunning () { 23 if [ ! -f $ANOPEPID ] ; then 24 echo "Warning: Anope is not currently running" 25 exit 1 26 fi 27 28 PID=`cat $ANOPEPID` 29 kill -0 $PID 2>/dev/null 30 if [ $? -ne 0 ] ; then 31 echo "Warning: Anope is not currently running" 32 exit 1 33 fi 34 } 35 36 if [ ! -f $ANOPROG ] ; then 37 echo "Error: $ANOPROG cannot be accessed" 38 exit 1 39 fi 40 41 if [ "$UID" = "0" ] ; then 42 echo "######################################"; 43 echo "# Warning: Do NOT run Anope as root! #"; 44 echo "######################################"; 45 exit 1 46 fi 47 48 if [ "$1" = "start" ] ; then 49 if [ -f $ANOPEPID ] ; then 50 PID=`cat $ANOPEPID` 51 kill -0 $PID 2>/dev/null 52 if [ $? -eq 0 ] ; then 53 echo "Warning! Anope is already running" 54 exit 1 55 fi 56 fi 57 58 echo "Starting Anope" 59 shift 60 $ANOPROG $* 61 62 if [ "$?" -ne "0" ] ; then 63 echo "" 64 echo "Unfortunately it seems Anope did not start successfully" 65 echo "This error has been logged in your Anope Log file" 66 echo "Located in "$LOG"" 67 echo "This may help you diagnose the problem" 68 echo "Further help may be available from https://www.anope.org/" 69 exit 1 70 fi 71 72 elif [ "$1" = "stop" ] ; then 73 isAnopeRunning 74 echo "Terminating Anope" 75 kill -15 `cat $ANOPEPID` 76 77 elif [ "$1" = "status" ] ; then 78 if [ -f $ANOPEPID ] ; then 79 PID=`cat $ANOPEPID` 80 kill -0 $PID 2>/dev/null 81 if [ $? -eq 0 ] ; then 82 echo "Anope is currently running" 83 exit 0 84 fi 85 fi 86 87 echo "Anope is not currently running" 88 89 elif [ "$1" = "restart" ] ; then 90 isAnopeRunning 91 echo "Restarting Anope" 92 kill -15 `cat $ANOPEPID` 93 sleep 1 94 95 shift 96 $ANOPROG $* 97 98 if [ "$?" -ne "0" ] ; then 99 echo "" 100 echo "Unfortunately it seems Anope did not start successfully" 101 echo "This error has been logged in your Anope Log file" 102 echo "Located in "$LOG"" 103 echo "This may help you diagnose the problem" 104 echo "Further help may be available from https://www.anope.org/" 105 exit 1 106 fi 107 108 elif [ "$1" = "rehash" ] ; then 109 isAnopeRunning 110 echo "Saving Databases and Rehashing Configuration" 111 kill -1 `cat $ANOPEPID` 112 113 elif [ "$1" = "version" ] ; then 114 $ANOPROG -version 115 116 elif [ "$1" = "help" ] ; then 117 if [ "$2" = "paramlist" ] ; then 118 $ANOPROG -help 119 else 120 echo "AnopeRC is a remote control script for easy" 121 echo "controlling of Anope from the command console" 122 echo "$0 start Start Anope." 123 echo "$0 stop Shutdown Anope" 124 echo "$0 status Show Anope's Status" 125 echo "$0 restart Restart Anope (Databases will be saved)." 126 echo "$0 rehash Rehash Configuration and Save Databases" 127 echo "$0 version Return Anope Version and Build Information" 128 echo "$0 help Show this help menu" 129 echo "If you need further help please check the /docs/" 130 echo "folder or make use of our extensive online support at" 131 echo "https://www.anope.org/" 132 fi 133 134 else 135 echo "Anope Remote Control ($ARCVERSION)" 136 echo "Usage: $0 [start|stop|status|restart|rehash|version|help]" 137 fi