added rcon password support

This commit is contained in:
officereso 2020-02-26 21:15:38 -06:00
parent 7033f672dd
commit 8c5697a883
2 changed files with 4 additions and 2 deletions

1
.gitignore vendored
View File

@ -1,3 +1,4 @@
/sqlPass.txt
/token.txt
/scr/Modules/SSC/ChangeServer/text.txt
/rcon.txt

View File

@ -5,6 +5,7 @@ import os
from mcrcon import MCRcon
password = open("../sqlPass.txt", 'r').read()
rcon = open("../rcon.txt", 'r').read()
con = pymysql.connect(host='localhost',
user='Bot',
@ -34,10 +35,10 @@ def change(ip1, ip2):
os.system("systemctl stop mc mcL mcP mcEvent1 mcEvent2")
for i in range(len(allServerRcon)):
print("192.168.1.52 " + f"{password} " + str(allServerRcon[i]['serverRCON']) + "________________________________________________________________________________________________")
print("192.168.1.52 " + f"{rcon} " + str(allServerRcon[i]['serverRCON']) + "________________________________________________________________________________________________")
for i in range(len(allServerRcon)):
with MCRcon("192.168.1.52", f"{password}", port=allServerRcon[i]['serverRCON']) as mcr:
with MCRcon("192.168.1.52", f"{rcon}", port=allServerRcon[i]['serverRCON']) as mcr:
mcr.command("stop")
f = open("/etc/systemd/system/mcEvent1.service", "w")