19 lines
482 B
Python
Executable file
19 lines
482 B
Python
Executable file
#!/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)
|