Add: auto restart

This commit is contained in:
iceBear67 committed 2024-09-17 15:30:19 +08:00
1 parent 05c72e5470
commit 4991e2541b
1 file changed
+8
+8
View File
@@ -27,3 +27,11 @@ fi
special_curl "$SIGNED_URL&directory=/mods" -X POST -F "files=@$UPLOAD"
echo "Uploaded!"
BROADCAST="[ SFCRAFT UPDATE ] Server is shutting down in 10s, please be ready."
special_curl "$API_ENDPOINT/api/client/servers/$SERVER_ID/command" -H "Authorization: Bearer $TOKEN" -X POST -d "{\"command\":\"say $BROADCAST\"}"
echo "Broadcast is sent!"
sleep 10s
special_curl "$API_ENDPOINT/api/client/servers/$SERVER_ID/power" -H "Authorization: Bearer $TOKEN" -X POST -d "{\"signal\":\"restart\"}"
echo "Signal is sent!"