Add an admin script to check if mumble's WebUI is currently in use.
This commit is contained in:
parent
bd0ddcc899
commit
c2930509fc
31
active_web_users
Executable file
31
active_web_users
Executable file
@ -0,0 +1,31 @@
|
|||||||
|
#! /bin/bash
|
||||||
|
|
||||||
|
# Parse mumble logs in order to determine if someone is currently accessing
|
||||||
|
# mumble through the WebUI. If not it means we can safely restart nginx
|
||||||
|
# on the reverse-proxy side without bothering anyone :)
|
||||||
|
|
||||||
|
MUMBLE_LOG=/var/log/mumble-server/mumble-server.log
|
||||||
|
|
||||||
|
|
||||||
|
main() {
|
||||||
|
candidates=$(last_connections)
|
||||||
|
for candidate in ${candidates}; do
|
||||||
|
grep "<${candidate}:" "${MUMBLE_LOG}" | tail -n 1 | grep -q 'Connection closed'
|
||||||
|
if [ $? -ne 0 ]; then
|
||||||
|
echo "At least one person is currently using mumble's Web interface."
|
||||||
|
grep "<${candidate}:" "${MUMBLE_LOG}" | tail -n 5
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
echo "It looks like nobody is currently using mumble's Web interface. You may restart nginx if you want ;)"
|
||||||
|
exit 0
|
||||||
|
}
|
||||||
|
|
||||||
|
last_connections() {
|
||||||
|
grep 'Client.*Node.js' "${MUMBLE_LOG}" \
|
||||||
|
| tail -n 10 \
|
||||||
|
| sed -r 's/^.*=> <([0-9]+):\(-1\)>.*$/\1/' \
|
||||||
|
| tac
|
||||||
|
}
|
||||||
|
|
||||||
|
main
|
Loading…
Reference in New Issue
Block a user