20 lines
489 B
Python
20 lines
489 B
Python
|
#!/usr/bin/env python3
|
||
|
import time
|
||
|
import sys
|
||
|
from mcrcon import MCRcon
|
||
|
from CONFIG import HOST,PW,PORT
|
||
|
|
||
|
flushed=False
|
||
|
with MCRcon(HOST, PW, port=PORT) as mcr:
|
||
|
resp = mcr.command("say BACKUP STARTED")
|
||
|
resp = mcr.command("save-off")
|
||
|
resp = mcr.command("save-all flush")
|
||
|
if "Saved the game" in resp:
|
||
|
flushed=True
|
||
|
print("Flushed map successfully. Don't forget to run enable_autosave.py after the map backup")
|
||
|
|
||
|
if flushed:
|
||
|
sys.exit(0)
|
||
|
else:
|
||
|
sys.exit(1)
|