Skip to content

Commit

Permalink
Add: auto restart
Browse files Browse the repository at this point in the history
  • Loading branch information
iceBear67 committed Sep 17, 2024
1 parent 05c72e5 commit 4991e25
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions scripts/update.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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!"

0 comments on commit 4991e25

Please sign in to comment.