serverwatcher 3.1.4__tar.gz → 3.1.6__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-3.1.4/src/serverwatcher.egg-info → serverwatcher-3.1.6}/PKG-INFO +1 -1
- {serverwatcher-3.1.4 → serverwatcher-3.1.6}/pyproject.toml +6 -1
- serverwatcher-3.1.6/src/serverwatcher/defaultconfigs/global.yaml +16 -0
- serverwatcher-3.1.6/src/serverwatcher/defaultconfigs/messages.yaml +41 -0
- serverwatcher-3.1.6/src/serverwatcher/defaultconfigs/watcher.yaml +28 -0
- {serverwatcher-3.1.4 → serverwatcher-3.1.6}/src/serverwatcher/watcher.py +13 -7
- {serverwatcher-3.1.4 → serverwatcher-3.1.6/src/serverwatcher.egg-info}/PKG-INFO +1 -1
- {serverwatcher-3.1.4 → serverwatcher-3.1.6}/src/serverwatcher.egg-info/SOURCES.txt +4 -1
- {serverwatcher-3.1.4 → serverwatcher-3.1.6}/LICENSE +0 -0
- {serverwatcher-3.1.4 → serverwatcher-3.1.6}/README.md +0 -0
- {serverwatcher-3.1.4 → serverwatcher-3.1.6}/setup.cfg +0 -0
- {serverwatcher-3.1.4 → serverwatcher-3.1.6}/src/serverwatcher/__init__.py +0 -0
- {serverwatcher-3.1.4 → serverwatcher-3.1.6}/src/serverwatcher/config/global_config.py +0 -0
- {serverwatcher-3.1.4 → serverwatcher-3.1.6}/src/serverwatcher/config/messages.py +0 -0
- {serverwatcher-3.1.4 → serverwatcher-3.1.6}/src/serverwatcher/config/watcher.py +0 -0
- {serverwatcher-3.1.4 → serverwatcher-3.1.6}/src/serverwatcher/schema.py +0 -0
- {serverwatcher-3.1.4 → serverwatcher-3.1.6}/src/serverwatcher.egg-info/dependency_links.txt +0 -0
- {serverwatcher-3.1.4 → serverwatcher-3.1.6}/src/serverwatcher.egg-info/requires.txt +0 -0
- {serverwatcher-3.1.4 → serverwatcher-3.1.6}/src/serverwatcher.egg-info/top_level.txt +0 -0
|
@@ -7,7 +7,7 @@ build-backend = "setuptools.build_meta"
|
|
|
7
7
|
|
|
8
8
|
[project]
|
|
9
9
|
name = "serverwatcher"
|
|
10
|
-
version = "3.1.
|
|
10
|
+
version = "3.1.6"
|
|
11
11
|
description = "A HungerLib-powered Minecraft server automation engine."
|
|
12
12
|
readme = "README.md"
|
|
13
13
|
requires-python = ">=3.10"
|
|
@@ -53,3 +53,8 @@ Issues = "https://github.com/iFamishedX/ServerWatcher/issues"
|
|
|
53
53
|
where = [
|
|
54
54
|
"src",
|
|
55
55
|
]
|
|
56
|
+
|
|
57
|
+
[tool.setuptools.package-data]
|
|
58
|
+
serverwatcher = [
|
|
59
|
+
"defaultconfigs/*.yaml",
|
|
60
|
+
]
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
panel:
|
|
2
|
+
name: My Panel
|
|
3
|
+
url: https://example.com
|
|
4
|
+
api_key: CHANGE_ME
|
|
5
|
+
|
|
6
|
+
origin:
|
|
7
|
+
server_id: CHANGE_ME
|
|
8
|
+
|
|
9
|
+
server:
|
|
10
|
+
name: My SMP
|
|
11
|
+
server_id: CHANGE_ME
|
|
12
|
+
domain: mc.hungersmp.com
|
|
13
|
+
port: 25565
|
|
14
|
+
rcon_port: 25575
|
|
15
|
+
rcon_password: password
|
|
16
|
+
tps_command: ticks
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
prefix: "<aqua>[Server Watcher]"
|
|
2
|
+
|
|
3
|
+
broadcast_restart_at: "{prefix} The server will restart at {time} CDT."
|
|
4
|
+
|
|
5
|
+
broadcast_minute:
|
|
6
|
+
120: "{prefix} Restart in 2 hours!"
|
|
7
|
+
60: "{prefix} Restart in 1 hour!"
|
|
8
|
+
45: "{prefix} Restart in 45 minutes!"
|
|
9
|
+
30: "{prefix} Restart in 30 minutes!"
|
|
10
|
+
15: "{prefix} Restart in 15 minutes!"
|
|
11
|
+
5: "{prefix} Restart in 5 minutes!"
|
|
12
|
+
1: "{prefix} Restart in 1 minute!"
|
|
13
|
+
|
|
14
|
+
broadcast_second:
|
|
15
|
+
10: "{prefix} Restart in 10 seconds!"
|
|
16
|
+
9: "{prefix} Restart in 9 seconds!"
|
|
17
|
+
8: "{prefix} Restart in 8 seconds!"
|
|
18
|
+
7: "{prefix} Restart in 7 seconds!"
|
|
19
|
+
6: "{prefix} Restart in 6 seconds!"
|
|
20
|
+
5: "{prefix} Restart in 5 seconds!"
|
|
21
|
+
4: "{prefix} Restart in 4 seconds!"
|
|
22
|
+
3: "{prefix} Restart in 3 seconds!"
|
|
23
|
+
2: "{prefix} Restart in 2 seconds!"
|
|
24
|
+
1: "{prefix} Restart in 1 second!"
|
|
25
|
+
|
|
26
|
+
log_start: "ServerWatcher is running!"
|
|
27
|
+
log_validation_fail: "Validation FAILED."
|
|
28
|
+
log_validation_ok: "All validation checks succeeded."
|
|
29
|
+
log_immediate_restart: "Restarting immediately."
|
|
30
|
+
log_no_restart: "The server does not need to restart."
|
|
31
|
+
log_scheduled: "Restart needed, but anti-restart factors outweigh it."
|
|
32
|
+
log_gap_low: "Gap {gap}. Scheduling restart in 2 hours."
|
|
33
|
+
log_gap_high: "Gap {gap}. Scheduling restart in 1 hour."
|
|
34
|
+
|
|
35
|
+
reason_restart_soon: "The server is set to restart soon"
|
|
36
|
+
reason_ram: "RAM usage ({ram}) is higher than {threshold} GB"
|
|
37
|
+
reason_cpu: "CPU usage ({cpu}) is higher than {threshold}%"
|
|
38
|
+
reason_uptime: "Uptime {uptime} exceeds {threshold}h"
|
|
39
|
+
reason_tps: "TPS {tps} is lower than {threshold}"
|
|
40
|
+
reason_low_uptime: "Uptime {uptime} is shorter than 30m"
|
|
41
|
+
reason_players: "There {verb} {count} {plural} online"
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
restart_soon_schedule_id: 13
|
|
2
|
+
origin_disable_schedule_id: 11
|
|
3
|
+
|
|
4
|
+
ram_threshold: 6
|
|
5
|
+
cpu_threshold: 150
|
|
6
|
+
uptime_hours_threshold: 12
|
|
7
|
+
tps_threshold: 19.5
|
|
8
|
+
|
|
9
|
+
weight_restart_soon: 3
|
|
10
|
+
weight_ram: 1
|
|
11
|
+
weight_cpu: 1
|
|
12
|
+
weight_uptime: 1
|
|
13
|
+
weight_tps: 1
|
|
14
|
+
|
|
15
|
+
weight_low_uptime: 5
|
|
16
|
+
weight_per_player: 1
|
|
17
|
+
|
|
18
|
+
low_gap_minutes: 120
|
|
19
|
+
high_gap_minutes: 60
|
|
20
|
+
|
|
21
|
+
restart_wait_seconds: 45
|
|
22
|
+
restart_online_timeout: 120
|
|
23
|
+
restart_online_interval: 2
|
|
24
|
+
|
|
25
|
+
logger_name_template: "Server Watcher"
|
|
26
|
+
log_path: "/home/container/logs/"
|
|
27
|
+
console_backspaces: 8
|
|
28
|
+
timezone: "America/Chicago"
|
|
@@ -20,6 +20,8 @@ from serverwatcher.config.global_config import GlobalConfig
|
|
|
20
20
|
from serverwatcher.config.messages import MessagesConfig
|
|
21
21
|
from serverwatcher.config.watcher import WatcherConfig
|
|
22
22
|
|
|
23
|
+
# BASE DIRECTORY OF THIS PACKAGE
|
|
24
|
+
BASE_DIR = os.path.dirname(__file__)
|
|
23
25
|
|
|
24
26
|
# ---------------------------------------------------------
|
|
25
27
|
# Utility: load config or copy default from defaultconfigs/
|
|
@@ -29,12 +31,16 @@ def load_or_default(path: str, default_path: str, schema):
|
|
|
29
31
|
Loads YAML from path. If missing, copies default_path → path.
|
|
30
32
|
Then maps YAML → dataclass.
|
|
31
33
|
"""
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
34
|
+
|
|
35
|
+
abs_path = os.path.join(BASE_DIR, path)
|
|
36
|
+
abs_default = os.path.join(BASE_DIR, default_path)
|
|
37
|
+
|
|
38
|
+
if not os.path.exists(abs_path):
|
|
39
|
+
os.makedirs(os.path.dirname(abs_path), exist_ok=True)
|
|
40
|
+
with open(abs_default, "r") as src, open(abs_path, "w") as dst:
|
|
35
41
|
dst.write(src.read())
|
|
36
42
|
|
|
37
|
-
raw = load_yaml(
|
|
43
|
+
raw = load_yaml(abs_path)
|
|
38
44
|
return map_to_dataclass(raw, schema)
|
|
39
45
|
|
|
40
46
|
|
|
@@ -46,19 +52,19 @@ class ServerWatcher:
|
|
|
46
52
|
# Load all 3 configs
|
|
47
53
|
self.global_cfg: GlobalConfig = load_or_default(
|
|
48
54
|
"config/global.yaml",
|
|
49
|
-
"
|
|
55
|
+
"defaultconfigs/global.yaml",
|
|
50
56
|
GlobalConfig
|
|
51
57
|
)
|
|
52
58
|
|
|
53
59
|
self.messages: MessagesConfig = load_or_default(
|
|
54
60
|
"config/messages.yaml",
|
|
55
|
-
"
|
|
61
|
+
"defaultconfigs/messages.yaml",
|
|
56
62
|
MessagesConfig
|
|
57
63
|
)
|
|
58
64
|
|
|
59
65
|
self.cfg: WatcherConfig = load_or_default(
|
|
60
66
|
"config/watcher.yaml",
|
|
61
|
-
"
|
|
67
|
+
"defaultconfigs/watcher.yaml",
|
|
62
68
|
WatcherConfig
|
|
63
69
|
)
|
|
64
70
|
|
|
@@ -11,4 +11,7 @@ src/serverwatcher.egg-info/requires.txt
|
|
|
11
11
|
src/serverwatcher.egg-info/top_level.txt
|
|
12
12
|
src/serverwatcher/config/global_config.py
|
|
13
13
|
src/serverwatcher/config/messages.py
|
|
14
|
-
src/serverwatcher/config/watcher.py
|
|
14
|
+
src/serverwatcher/config/watcher.py
|
|
15
|
+
src/serverwatcher/defaultconfigs/global.yaml
|
|
16
|
+
src/serverwatcher/defaultconfigs/messages.yaml
|
|
17
|
+
src/serverwatcher/defaultconfigs/watcher.yaml
|
|
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
|