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

Give UnrealIRCd 10 seconds to terminate insteads of just 1, now that

we may have more database writing to do on terminate.

Actually 10 seconds would be really long, but 2-3 seconds may be
quite realistic if you have lots of TKLs, permanent channels,
reputation entries (users), etc.

Oh yeah, and I really hate writing PORTABLE shell code...
This commit is contained in:
Bram Matthys
2021-05-17 09:02:04 +02:00
parent 263593634e
commit 61e0ed3d03
+19 -2
View File
@@ -53,17 +53,34 @@ if [ "$1" = "start" ] ; then
# Now check if we need to create a crash report.
@BINDIR@/unrealircd -R
elif [ "$1" = "stop" ] ; then
echo "Stopping UnrealIRCd"
echo -n "Stopping UnrealIRCd"
if [ ! -r $PID_FILE ] ; then
echo
echo "ERROR: UnrealIRCd is not running"
exit 1
fi
kill -15 `cat $PID_FILE`
if [ "$?" != 0 ]; then
echo
echo "ERROR: UnrealIRCd is not running"
exit 1
fi
sleep 1
# Wait for UnrealIRCd to terminate, but wait 10 seconds max
n="0"
while [ "$n" -lt 10 ]
do
echo -n "."
if [ ! -r $PID_FILE ] ; then
break
fi
if ! kill -0 `cat $PID_FILE`; then
break
fi
n=`expr $n + 1`
sleep 1
done
echo
# In case it is still running, kill it for good.
if [ -r $PID_FILE ] ; then
kill -9 `cat $PID_FILE` 1>/dev/null 2>&1
fi