Adding files

This commit is contained in:
root
2024-01-29 01:36:31 +00:00
parent 9ee50dad6a
commit 1201c31a6e
12 changed files with 98 additions and 0 deletions

14
.gitignore vendored Normal file
View 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

2
10sec.txt Normal file
View File

@@ -0,0 +1,2 @@
Broadcast 10_SECONDS_TO_SERVER_RESTART
Exit

2
1min.txt Normal file
View File

@@ -0,0 +1,2 @@
Broadcast 1_MINUTE_TO_SERVER_RESTART
Exit

2
2min.txt Normal file
View File

@@ -0,0 +1,2 @@
Broadcast 2_MINUTES_TO_SERVER_RESTART
Exit

2
3min.txt Normal file
View File

@@ -0,0 +1,2 @@
Broadcast 3_MINUTES_TO_SERVER_RESTART
Exit

2
4min.txt Normal file
View File

@@ -0,0 +1,2 @@
Broadcast 4_MINUTES_TO_SERVER_RESTART
Exit

2
5min.txt Normal file
View File

@@ -0,0 +1,2 @@
Broadcast 5_MINUTES_TO_SERVER_RESTART
Exit

BIN
ARRCON Executable file

Binary file not shown.

BIN
ARRCON-3.3.7-Linux.zip Normal file

Binary file not shown.

2
commands.txt Normal file
View File

@@ -0,0 +1,2 @@
Broadcast Test
Exit

69
serverRestart.py Executable file
View 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)

1
test.sh Executable file
View File

@@ -0,0 +1 @@
ARRCON -H 192.168.0.190 -P 25575 -p bXe37GbFn08rWrOzaLAI -f commands.txt