Adding files
This commit is contained in:
14
.gitignore
vendored
Normal file
14
.gitignore
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
# ---> VirtualEnv
|
||||
# Virtualenv
|
||||
# http://iamzed.com/2009/05/07/a-primer-on-virtualenv/
|
||||
.Python
|
||||
[Bb]in
|
||||
[Ii]nclude
|
||||
[Ll]ib
|
||||
[Ll]ib64
|
||||
[Ll]ocal
|
||||
[Ss]cripts
|
||||
pyvenv.cfg
|
||||
.venv
|
||||
pip-selfcheck.json
|
||||
.zip
|
||||
BIN
ARRCON-3.3.7-Linux.zip
Normal file
BIN
ARRCON-3.3.7-Linux.zip
Normal file
Binary file not shown.
2
commands.txt
Normal file
2
commands.txt
Normal file
@@ -0,0 +1,2 @@
|
||||
Broadcast Test
|
||||
Exit
|
||||
69
serverRestart.py
Executable file
69
serverRestart.py
Executable file
@@ -0,0 +1,69 @@
|
||||
import time
|
||||
import subprocess
|
||||
import os
|
||||
|
||||
|
||||
def fiveMinWarning():
|
||||
print("Sending 5 minute Warning")
|
||||
subprocess.call("ARRCON -H 192.168.0.190 -P 25575 -p bXe37GbFn08rWrOzaLAI -f 5min.txt", shell=True)
|
||||
|
||||
def fourMinWarning():
|
||||
print("Sending 4 minute Warning")
|
||||
subprocess.call("ARRCON -H 192.168.0.190 -P 25575 -p bXe37GbFn08rWrOzaLAI -f 4min.txt", shell=True)
|
||||
|
||||
def threeMinWarning():
|
||||
print("Sending 3 minute Warning")
|
||||
subprocess.call("ARRCON -H 192.168.0.190 -P 25575 -p bXe37GbFn08rWrOzaLAI -f 3min.txt", shell=True)
|
||||
|
||||
def twoMinWarning():
|
||||
print("Sending 2 minute Warning")
|
||||
subprocess.call("ARRCON -H 192.168.0.190 -P 25575 -p bXe37GbFn08rWrOzaLAI -f 2min.txt", shell=True)
|
||||
|
||||
def oneMinWarning():
|
||||
print("Sending 1 minute Warning")
|
||||
subprocess.call("ARRCON -H 192.168.0.190 -P 25575 -p bXe37GbFn08rWrOzaLAI -f 1min.txt", shell=True)
|
||||
|
||||
def tenSecWarning():
|
||||
print("Sending 10 sec warning")
|
||||
subprocess.call("ARRCON -H 192.168.0.190 -P 25575 -p bXe37GbFn08rWrOzaLAI -f 10sec.txt", shell=True)
|
||||
time.sleep(10)
|
||||
restartServer()
|
||||
|
||||
def restartServer():
|
||||
subprocess.call("docker container restart palworld-server", shell=True)
|
||||
|
||||
import time
|
||||
|
||||
def timer(duration, interval, statements):
|
||||
start_time = time.time()
|
||||
next_statement_time = start_time + interval
|
||||
statement_index = 0
|
||||
isRunning = True
|
||||
|
||||
while time.time() - start_time < duration:
|
||||
if time.time() >= next_statement_time:
|
||||
if statement_index < len(statements):
|
||||
calledFunction = statements[statement_index]
|
||||
result = calledFunction()
|
||||
statement_index += 1
|
||||
next_statement_time += interval
|
||||
else:
|
||||
print("Complete")
|
||||
break
|
||||
time.sleep(0.1) # Adjust the sleep time to reduce CPU usage
|
||||
|
||||
# Example usage
|
||||
duration = 500 # Duration of the timer in seconds
|
||||
interval = 60 # Interval between statements in seconds
|
||||
statements = [
|
||||
fiveMinWarning,
|
||||
fourMinWarning,
|
||||
threeMinWarning,
|
||||
twoMinWarning,
|
||||
oneMinWarning,
|
||||
tenSecWarning
|
||||
]
|
||||
|
||||
|
||||
timer(duration, interval, statements)
|
||||
|
||||
Reference in New Issue
Block a user