18 lines
628 B
Bash
18 lines
628 B
Bash
#!/usr/bin/env bash
|
|
|
|
function help() {
|
|
echo -e "usage: $(basename ${0}) --server $1 <operation>
|
|
operations:
|
|
$(basename ${0}) --server $1 broadcast \"[message]\""
|
|
}
|
|
|
|
function restart_announcement() {
|
|
for count in {10..1}; do
|
|
broadcast "$1" "Server restarting in $count"
|
|
done
|
|
}
|
|
|
|
function broadcast() {
|
|
local dir="$(getValueByKey 'PODMAN_DIRECTORY')/${1}"
|
|
podman exec -it "$1" rcon -m -H 127.0.0.1 -p 25575 -P $(grep -E "^rcon.password" $dir/data/server.properties | cut -d= -f2) tellraw @a [{\"text\":\"[SYSTEM] \",\"color\":\"red\",\"bold\":true},{\"text\": \"$2\",\"color\":\"light_purple\",\"bold\":false}]
|
|
}
|