slower mc shutdow

This commit is contained in:
royalcat 2025-03-30 03:53:43 +04:00
parent d627a2aedd
commit f1b0bef3f2

View file

@ -142,7 +142,7 @@ metadata:
name: mc-shutdown name: mc-shutdown
namespace: minecraft namespace: minecraft
spec: spec:
schedule: "*/5 * * * *" schedule: "*/30 * * * *"
concurrencyPolicy: Forbid concurrencyPolicy: Forbid
jobTemplate: jobTemplate:
spec: spec:
@ -183,8 +183,8 @@ data:
#!/bin/bash #!/bin/bash
MC_PODS=$(kubectl get pods -l containertype=minecraft-server -o=jsonpath="{range .items[*]}{.metadata.name},"| sed 's/,/\n/g') MC_PODS=$(kubectl get pods -l containertype=minecraft-server -o=jsonpath="{range .items[*]}{.metadata.name},"| sed 's/,/\n/g')
for p in $MC_PODS; do for p in $MC_PODS; do
echo "found minecraft pod $p, sleeping 120 seconds to prevent shutdown before login" echo "found minecraft pod $p, sleeping 300 seconds to prevent shutdown before login"
sleep 120 sleep 300
deployment=$(echo $p |sed 's/-0//g') deployment=$(echo $p |sed 's/-0//g')
# check online player count in the mc server # check online player count in the mc server
if [[ $(kubectl exec -i $p -- /usr/local/bin/mc-monitor status) == *"online=0"* ]] ;then if [[ $(kubectl exec -i $p -- /usr/local/bin/mc-monitor status) == *"online=0"* ]] ;then