You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
tools/enable_autosave.py

19 lines
482 B

#!/usr/bin/env python3
import time
import sys
from mcrcon import MCRcon
from CONFIG import HOST,PW,PORT
autosave_on=False
with MCRcon(HOST, PW, port=PORT) as mcr:
resp = mcr.command("save-on")
if "Automatic saving is now enabled" in resp:
autosave_on=True
resp = mcr.command("say BACKUP FINISHED")
if autosave_on:
print("Autosave successfuly enabled.")
sys.exit(0)
else:
print("Enabling autosave failed. Was it already turned on?")
sys.exit(1)