diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..7df0563 --- /dev/null +++ b/.gitignore @@ -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 diff --git a/10sec.txt b/10sec.txt new file mode 100644 index 0000000..a49771b --- /dev/null +++ b/10sec.txt @@ -0,0 +1,2 @@ +Broadcast 10_SECONDS_TO_SERVER_RESTART +Exit diff --git a/1min.txt b/1min.txt new file mode 100644 index 0000000..64b93a8 --- /dev/null +++ b/1min.txt @@ -0,0 +1,2 @@ +Broadcast 1_MINUTE_TO_SERVER_RESTART +Exit diff --git a/2min.txt b/2min.txt new file mode 100644 index 0000000..3c0c441 --- /dev/null +++ b/2min.txt @@ -0,0 +1,2 @@ +Broadcast 2_MINUTES_TO_SERVER_RESTART +Exit diff --git a/3min.txt b/3min.txt new file mode 100644 index 0000000..9a71a06 --- /dev/null +++ b/3min.txt @@ -0,0 +1,2 @@ +Broadcast 3_MINUTES_TO_SERVER_RESTART +Exit diff --git a/4min.txt b/4min.txt new file mode 100644 index 0000000..bf8cbe2 --- /dev/null +++ b/4min.txt @@ -0,0 +1,2 @@ +Broadcast 4_MINUTES_TO_SERVER_RESTART +Exit diff --git a/5min.txt b/5min.txt new file mode 100644 index 0000000..17d3d01 --- /dev/null +++ b/5min.txt @@ -0,0 +1,2 @@ +Broadcast 5_MINUTES_TO_SERVER_RESTART +Exit diff --git a/ARRCON b/ARRCON new file mode 100755 index 0000000..da13b5d Binary files /dev/null and b/ARRCON differ diff --git a/ARRCON-3.3.7-Linux.zip b/ARRCON-3.3.7-Linux.zip new file mode 100644 index 0000000..bb45b68 Binary files /dev/null and b/ARRCON-3.3.7-Linux.zip differ diff --git a/commands.txt b/commands.txt new file mode 100644 index 0000000..5bbc1b3 --- /dev/null +++ b/commands.txt @@ -0,0 +1,2 @@ +Broadcast Test +Exit diff --git a/serverRestart.py b/serverRestart.py new file mode 100755 index 0000000..1af8a57 --- /dev/null +++ b/serverRestart.py @@ -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) + diff --git a/test.sh b/test.sh new file mode 100755 index 0000000..239a7ef --- /dev/null +++ b/test.sh @@ -0,0 +1 @@ +ARRCON -H 192.168.0.190 -P 25575 -p bXe37GbFn08rWrOzaLAI -f commands.txt