serverwatcher 4.0__tar.gz → 4.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {serverwatcher-4.0/src/serverwatcher.egg-info → serverwatcher-4.1}/PKG-INFO +1 -1
- {serverwatcher-4.0 → serverwatcher-4.1}/pyproject.toml +1 -1
- {serverwatcher-4.0 → serverwatcher-4.1}/src/serverwatcher/configclasses/global_config.py +10 -0
- {serverwatcher-4.0 → serverwatcher-4.1}/src/serverwatcher/configclasses/watcher.py +1 -10
- {serverwatcher-4.0 → serverwatcher-4.1}/src/serverwatcher/defaultconfigs/global.yaml +12 -0
- {serverwatcher-4.0 → serverwatcher-4.1}/src/serverwatcher/defaultconfigs/watcher.yaml +1 -13
- {serverwatcher-4.0 → serverwatcher-4.1}/src/serverwatcher/watcher.py +11 -10
- {serverwatcher-4.0 → serverwatcher-4.1/src/serverwatcher.egg-info}/PKG-INFO +1 -1
- {serverwatcher-4.0 → serverwatcher-4.1}/LICENSE +0 -0
- {serverwatcher-4.0 → serverwatcher-4.1}/README.md +0 -0
- {serverwatcher-4.0 → serverwatcher-4.1}/setup.cfg +0 -0
- {serverwatcher-4.0 → serverwatcher-4.1}/src/serverwatcher/__init__.py +0 -0
- {serverwatcher-4.0 → serverwatcher-4.1}/src/serverwatcher/configclasses/__init__.py +0 -0
- {serverwatcher-4.0 → serverwatcher-4.1}/src/serverwatcher/configclasses/messages.py +0 -0
- {serverwatcher-4.0 → serverwatcher-4.1}/src/serverwatcher/defaultconfigs/messages.yaml +0 -0
- {serverwatcher-4.0 → serverwatcher-4.1}/src/serverwatcher.egg-info/SOURCES.txt +0 -0
- {serverwatcher-4.0 → serverwatcher-4.1}/src/serverwatcher.egg-info/dependency_links.txt +0 -0
- {serverwatcher-4.0 → serverwatcher-4.1}/src/serverwatcher.egg-info/requires.txt +0 -0
- {serverwatcher-4.0 → serverwatcher-4.1}/src/serverwatcher.egg-info/top_level.txt +0 -0
|
@@ -2,6 +2,8 @@ from dataclasses import dataclass
|
|
|
2
2
|
|
|
3
3
|
@dataclass
|
|
4
4
|
class GlobalConfig:
|
|
5
|
+
watch_interval: int
|
|
6
|
+
|
|
5
7
|
panel_name: str
|
|
6
8
|
panel_url: str
|
|
7
9
|
panel_api_key: str
|
|
@@ -15,3 +17,11 @@ class GlobalConfig:
|
|
|
15
17
|
rcon_port: int
|
|
16
18
|
rcon_password: str
|
|
17
19
|
tps_command: str
|
|
20
|
+
|
|
21
|
+
do_logging: bool
|
|
22
|
+
logger_name: str
|
|
23
|
+
log_path: str
|
|
24
|
+
timezone: str
|
|
25
|
+
|
|
26
|
+
console_backspaces: int
|
|
27
|
+
clear_terminal: bool
|
|
@@ -24,13 +24,4 @@ class WatcherConfig:
|
|
|
24
24
|
|
|
25
25
|
restart_wait_seconds: int
|
|
26
26
|
restart_online_timeout: int
|
|
27
|
-
restart_online_interval: int
|
|
28
|
-
|
|
29
|
-
logger_name_template: str
|
|
30
|
-
log_path: str
|
|
31
|
-
console_backspaces: int
|
|
32
|
-
timezone: str
|
|
33
|
-
|
|
34
|
-
# New values (will reorder later)
|
|
35
|
-
watch_interval: int
|
|
36
|
-
clear_terminal: bool
|
|
27
|
+
restart_online_interval: int
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
watch_interval: 60
|
|
2
|
+
|
|
1
3
|
panel:
|
|
2
4
|
panel_name: My Panel
|
|
3
5
|
panel_url: https://example.com
|
|
@@ -14,3 +16,13 @@ server:
|
|
|
14
16
|
rcon_port: 25575
|
|
15
17
|
rcon_password: password
|
|
16
18
|
tps_command: ticks
|
|
19
|
+
|
|
20
|
+
logging:
|
|
21
|
+
do_logging: True
|
|
22
|
+
logger_name: "Server Watcher"
|
|
23
|
+
log_path: "/home/container/logs/"
|
|
24
|
+
timezone: "America/Chicago"
|
|
25
|
+
|
|
26
|
+
terminal:
|
|
27
|
+
console_backspaces: 8
|
|
28
|
+
clear_terminal: True
|
|
@@ -1,12 +1,3 @@
|
|
|
1
|
-
logging:
|
|
2
|
-
logger_name_template: "Server Watcher"
|
|
3
|
-
log_path: "/home/container/logs/"
|
|
4
|
-
timezone: "America/Chicago"
|
|
5
|
-
|
|
6
|
-
terminal_settings:
|
|
7
|
-
console_backspaces: 8
|
|
8
|
-
clear_terminal: True
|
|
9
|
-
|
|
10
1
|
schedules:
|
|
11
2
|
restart_soon_schedule_id: 0 # replace this with real schedule id
|
|
12
3
|
origin_disable_schedule_id: 0 # replace this with real schedule id
|
|
@@ -33,7 +24,4 @@ gaps:
|
|
|
33
24
|
restart_intervals:
|
|
34
25
|
restart_wait_seconds: 45
|
|
35
26
|
restart_online_timeout: 120
|
|
36
|
-
restart_online_interval: 2
|
|
37
|
-
|
|
38
|
-
watcher_intervals:
|
|
39
|
-
watch_interval: 60
|
|
27
|
+
restart_online_interval: 2
|
|
@@ -14,8 +14,9 @@ from hungerlib.addons import (
|
|
|
14
14
|
loadConfig,
|
|
15
15
|
)
|
|
16
16
|
|
|
17
|
-
from serverwatcher import GlobalConfig
|
|
18
|
-
|
|
17
|
+
from serverwatcher.configclasses.global_config import GlobalConfig
|
|
18
|
+
from serverwatcher.configclasses.messages import MessagesConfig
|
|
19
|
+
from serverwatcher.configclasses.watcher import WatcherConfig
|
|
19
20
|
|
|
20
21
|
class ServerWatcher:
|
|
21
22
|
def __init__(self):
|
|
@@ -63,18 +64,18 @@ class ServerWatcher:
|
|
|
63
64
|
tpsCommand=self.global_cfg.tps_command,
|
|
64
65
|
)
|
|
65
66
|
|
|
66
|
-
logger_name = self.
|
|
67
|
+
logger_name = self.global_cfg.logger_name.format(
|
|
67
68
|
server_name=self.global_cfg.server_name
|
|
68
69
|
)
|
|
69
70
|
|
|
70
71
|
self.log = HungerLogger(
|
|
71
72
|
name=logger_name,
|
|
72
73
|
server=self.server,
|
|
73
|
-
log_path=self.
|
|
74
|
-
console_backspaces=self.
|
|
74
|
+
log_path=self.global_cfg.log_path,
|
|
75
|
+
console_backspaces=self.global_cfg.console_backspaces,
|
|
75
76
|
)
|
|
76
77
|
|
|
77
|
-
self.tz = ZoneInfo(self.
|
|
78
|
+
self.tz = ZoneInfo(self.global_cfg.timezone)
|
|
78
79
|
|
|
79
80
|
# utility
|
|
80
81
|
def fmt(self, template: str, **kwargs):
|
|
@@ -100,7 +101,7 @@ class ServerWatcher:
|
|
|
100
101
|
|
|
101
102
|
if alive:
|
|
102
103
|
self.log.info(self.messages.server_back_online)
|
|
103
|
-
self.server.sendBroadcast(self.messages.server_back_online_broadcast)
|
|
104
|
+
self.server.sendBroadcast(f"{self.messages.server_back_online_broadcast}")
|
|
104
105
|
self.origin.enableSchedule(self.cfg.origin_disable_schedule_id)
|
|
105
106
|
else:
|
|
106
107
|
self.log.error(self.messages.server_failed_restart)
|
|
@@ -238,10 +239,10 @@ class ServerWatcher:
|
|
|
238
239
|
|
|
239
240
|
# main loop
|
|
240
241
|
def run(self):
|
|
241
|
-
if self.
|
|
242
|
+
if self.global_cfg.clear_terminal:
|
|
242
243
|
clearTerminal()
|
|
243
244
|
while True:
|
|
244
|
-
if self.
|
|
245
|
+
if self.global_cfg.clear_terminal:
|
|
245
246
|
clearTerminal()
|
|
246
247
|
self.evaluate()
|
|
247
|
-
time.sleep(self.
|
|
248
|
+
time.sleep(self.global_cfg.watch_interval)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|