autocommit
This commit is contained in:
parent
cd3a75d324
commit
92a8cfc9b7
4 changed files with 20 additions and 25 deletions
|
@ -1,16 +0,0 @@
|
||||||
#!/usr/bin/env bash
|
|
||||||
|
|
||||||
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}]
|
|
||||||
}
|
|
||||||
|
|
||||||
function countdown() {
|
|
||||||
local dir="$(getValueByKey 'PODMAN_DIRECTORY')/${1}"
|
|
||||||
|
|
||||||
for i in {10..1}; do
|
|
||||||
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\": \"$i\",\"color\":\"light_purple\",\"bold\":false}]
|
|
||||||
done
|
|
||||||
}
|
|
18
utils/fn_server/functions.sh
Normal file
18
utils/fn_server/functions.sh
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
#!/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}]
|
||||||
|
}
|
|
@ -1,7 +0,0 @@
|
||||||
#!/usr/bin/env bash
|
|
||||||
|
|
||||||
function help() {
|
|
||||||
echo -e "usage: $(basename ${0}) --server $1 <operation>
|
|
||||||
operations:
|
|
||||||
$(basename ${0}) --server $1 broadcast \"[message]\""
|
|
||||||
}
|
|
|
@ -16,9 +16,9 @@ function server() {
|
||||||
shift
|
shift
|
||||||
broadcast "$server" "$2"
|
broadcast "$server" "$2"
|
||||||
;;
|
;;
|
||||||
"countdown")
|
"restart")
|
||||||
shift
|
shift
|
||||||
countdown "$server"
|
restart_announcement "$server"
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
help "$server"
|
help "$server"
|
||||||
|
|
Loading…
Reference in a new issue