Created
July 30, 2019 18:45
-
-
Save lukeberry99/70fc95a27bcc0d371ccceee1d754695f to your computer and use it in GitHub Desktop.
Restart PufferPanel MC Server
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
SERVER_IP= | |
SERVER_ID= | |
SECRET= | |
CLIENT_ID= | |
DELAY=10 # Delay in seconds | |
response=`curl -X POST ${SERVER_IP}/oauth2/token/request -d "grant_type=client_credentials&client_id=${CLIENT_ID}&client_secret=${SECRET}"` | |
token=$(expr "$response" : '.*"access_token":"\([^"]*\)"') | |
echo "Stopping the server" | |
curl -X GET -H "Authorization: Bearer ${token}" ${SERVER_IP}:5656/server/${SERVER_ID}/stop | |
echo "\nWaiting to start the server" | |
sleep $DELAY | |
echo "\nStarting the server" | |
curl -X GET -H "Authorization: Bearer ${token}" ${SERVER_IP}:5656/server/${SERVER_ID}/start |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment