1
0
mirror of https://github.com/unrealircd/unrealircd.git synced 2026-06-12 17:14:46 +02:00

Make "./unrealircd rehash" show output on the terminal, same for

"./unrealircd reloadtls" and there is now also a "./unrealircd status"

The output is colorized if the terminal supports it (just like on the
boot screen) and also the exit status is 0 for success and non-0 for
failure. The purpose of all this is that you can easily detect rehash
errors on the command line.

These three commands communicate to UnrealIRCd via the new control
UNIX socket, which is in ~/data/unrealircd.ctl.
This also does a lot of other stuff because we now have an internal
tool called bin/unrealircdctl which is called by ./unrealircd for
some of the commands to communicate to the unrealircd.ctl socket.
Later on more of the existing functionality may be moved to that
tool and we may also provide it on Windows in CLI mode so people
have more of the same functionality as on *NIX.
This commit is contained in:
Bram Matthys
2022-01-02 20:10:52 +01:00
parent 834736070e
commit 39688517b0
23 changed files with 893 additions and 325 deletions
+6 -21
View File
@@ -2,6 +2,7 @@
PID_FILE="@PIDFILE@"
PID_BACKUP="@PIDFILE@.bak"
UNREALIRCDCTL="@BINDIR@/unrealircdctl"
# When built with --with-asan, ASan does not dump core by default because
# older gcc/clang might dump a 16TB core file. We explicitly enable it here.
@@ -87,16 +88,11 @@ elif [ "$1" = "stop" ] ; then
kill -9 `cat $PID_FILE` 1>/dev/null 2>&1
fi
elif [ "$1" = "rehash" ] ; then
echo "Rehashing UnrealIRCd"
if [ ! -r $PID_FILE ] ; then
echo "ERROR: UnrealIRCd is not running"
exit 1
fi
kill -1 `cat $PID_FILE`
if [ "$?" != 0 ]; then
echo "ERROR: UnrealIRCd is not running"
exit 1
fi
$UNREALIRCDCTL rehash
elif [ "$1" = "status" ] ; then
$UNREALIRCDCTL status
elif [ "$1" = "reloadtls" ] ; then
$UNREALIRCDCTL reloadtls
elif [ "$1" = "restart" ] ; then
echo "Restarting UnrealIRCd"
$0 stop
@@ -117,17 +113,6 @@ elif [ "$1" = "configtest" ] ; then
elif [ "$1" = "module" ] ; then
shift
@BINDIR@/unrealircd -m $*
elif [ "$1" = "reloadtls" ] ; then
echo "Reloading SSL/TLS certificates"
if [ ! -r $PID_FILE ] ; then
echo "ERROR: UnrealIRCd is not running"
exit 1
fi
kill -USR1 `cat $PID_FILE`
if [ "$?" != 0 ]; then
echo "ERROR: UnrealIRCd is not running"
exit 1
fi
elif [ "$1" = "mkpasswd" ] ; then
@BINDIR@/unrealircd -P $2 $3
elif [ "$1" = "version" ] ; then