Push change.py for testing on server.

This commit is contained in:
officereso 2020-02-23 21:53:35 -06:00
parent feb6fbfb4b
commit d7e63d662e
2 changed files with 30 additions and 13 deletions

View File

@ -31,13 +31,13 @@ def change(ip1, ip2):
os.system("systemctl stop mc mcL mcP mcEvent1 mcEvent2")
# for i in range(len(allServerRcon)):
# with MCRcon("192.168.1.52", "f{password}", allServerRcon[i]['serverIP']) as mcr:
# mcr.command("stop")
for i in range(len(allServerRcon)):
with MCRcon("192.168.1.52", "f{password}", allServerRcon[i]['serverIP']) as mcr:
mcr.command("stop")
# f = open("/etc/systemd/system/mcEvent1.service", "w")
f = open("/etc/systemd/system/mcEvent1.service", "w")
f = open("text.txt", 'w')
# f = open("text.txt", 'w')
f.write(
f"""\
[Unit]
@ -60,9 +60,9 @@ WantedBy=multi-user.target\
)
f.close()
# f = open("/etc/systemd/system/mcEvent2.service", "w")
f = open("/etc/syst1md/system/mcEvent2.service", "w")
f = open("text2.txt", 'w')
# f = open("text2.txt", 'w')
f.write(
f"""\
[Unit]
@ -85,7 +85,7 @@ WantedBy=multi-user.target\
)
f.close()
# f = open("/home/officereso/mcserver/lobby/plugins/ServerSelectorX/menu/default.yml
f = open("/home/officereso/mcserver/lobby/plugins/ServerSelectorX/menu/default.yml")
f.write(f"""\
# Number of rows of slots of your server selector menu. For example '2' will mean 2*9 = 18 slots. Max value is 6.
@ -146,9 +146,9 @@ menu:
# Server pinging help: https://github.com/ServerSelectorX/ServerSelectorX/wiki/Free-%7C-Server-Pinging
# With server pinging disabled, the placeholders don't work and the plugin will always use the offline section.
ping-server: false
ip: 66.69.103.65
port: 25568
ping-server: {"false" if server1[0]['selectorPing'] == 0 else "true"}
ip: 192.168.1.52
port: {server1[0]['serverIP']}
# Action to run when the item is clicked
action: 'srv:{server1[0]['action']}'
@ -197,6 +197,23 @@ menu:
offline:
item: LIGHT_GRAY_STAINED_GLASS_PANE\
""")
f.close()
os.system("systemctl daemon-reload")
os.system("systemctl enable mc mcL mcP mcEvent1 mcEvent2")
os.system("systemctl start mc mcL mcP mcEvent1 mcEvent2")
change(25570, 25568)
class Change(commands.Cog):
def __init__(self, client):
self.client = client
@commands.command(name="change")
def change_server(self, ctx, ip1, ip2):
if ctx.author != 305589587215122432:
return
change(ip1, ip2)
def setup(client):
client.add_cog(Change(client))

View File

@ -4,7 +4,7 @@ token = open("../token.txt")
cogs = ["Modules.TGH.automod.automod", "Modules.TGH.automod.ouat",
"Modules.SSC.autoReply.Join", "Modules.SSC.autoReply.Leave",
"Modules.Temp"]
"Modules.Temp", "Modules.SSC.ChangeServer.Change"]
prefix = 'o!'