Skip to content

Instantly share code, notes, and snippets.

@lukeberry99
Created July 30, 2019 18:45
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lukeberry99/70fc95a27bcc0d371ccceee1d754695f to your computer and use it in GitHub Desktop.
Save lukeberry99/70fc95a27bcc0d371ccceee1d754695f to your computer and use it in GitHub Desktop.
Restart PufferPanel MC Server
#!/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