forked from LuminariMUD/Luminari-Source
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathluminari.service
More file actions
executable file
·108 lines (98 loc) · 3.15 KB
/
Copy pathluminari.service
File metadata and controls
executable file
·108 lines (98 loc) · 3.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
# LuminariMUD systemd Service File
# =================================
#
# This service file manages the LuminariMUD game server using systemd.
# It provides automatic startup on boot, process management, and logging integration.
#
# INSTALLATION INSTRUCTIONS:
# -------------------------
# 1. Copy this file to systemd directory:
# sudo cp luminari.service /etc/systemd/system/
#
# 2. Reload systemd configuration:
# sudo systemctl daemon-reload
#
# 3. Enable service to start on boot:
# sudo systemctl enable luminari
#
# 4. Start the service:
# sudo systemctl start luminari
#
# MANAGEMENT COMMANDS:
# -------------------
# Start MUD: sudo systemctl start luminari
# Stop MUD: sudo systemctl stop luminari
# Restart MUD: sudo systemctl restart luminari
# Check status: sudo systemctl status luminari
# View logs: sudo journalctl -u luminari -f
# Disable: sudo systemctl disable luminari
#
# HOW IT WORKS:
# ------------
# 1. systemd starts autorun.sh which manages the MUD process
# 2. autorun.sh automatically starts its watchdog for extra protection
# 3. The MUD will auto-restart on crashes (handled by autorun.sh)
# 4. If autorun.sh itself fails, systemd will restart it after 60 seconds
# 5. Logs are sent to systemd journal for centralized logging
#
# PROTECTION LAYERS:
# -----------------
# Layer 1: autorun.sh keeps MUD running (restarts on crash)
# Layer 2: autorun-watchdog.sh monitors autorun.sh health
# Layer 3: systemd restarts everything if autorun.sh completely fails
#
# PREREQUISITES:
# -------------
# - User 'luminari' must exist
# - MUD installed at /home/luminari/Luminari-Source/
# - autorun.sh must be executable
# - MySQL/MariaDB should be running (but not required)
[Unit]
Description=LuminariMUD Game Server
After=network.target mysql.service
Wants=mysql.service
[Service]
Type=forking
User=luminari
Group=luminari
WorkingDirectory=/home/luminari/Luminari-Source
# autorun.sh now defaults to daemon mode and starts its own watchdog
ExecStart=/home/luminari/Luminari-Source/autorun.sh
ExecStop=/home/luminari/Luminari-Source/autorun.sh stop
ExecReload=/bin/kill -HUP $MAINPID
# Restart policy - let autorun handle restarts internally
# Only restart the service if autorun itself completely fails
Restart=on-failure
RestartSec=60
TimeoutStartSec=120
TimeoutStopSec=30
# Environment variables
Environment="MUD_PORT=4100"
Environment="MUD_FLAGS=-q"
Environment="ENABLE_WEBSOCKET=false"
Environment="ENABLE_FLASH=false"
Environment="IGNORE_DISK_SPACE=true"
# Process management
KillMode=control-group
KillSignal=SIGTERM
SendSIGKILL=no
# Security settings
NoNewPrivileges=true
PrivateTmp=true
# NOTE: The following settings are too restrictive and cause startup failures
# They prevent the autorun script from accessing necessary files
# ProtectSystem=strict # Would make system read-only
# ProtectHome=true # Would block access to /home/luminari
# ReadWritePaths=/home/luminari/Luminari-Source # Not needed without ProtectSystem
# Resource limits
LimitNOFILE=8192
LimitCORE=infinity
LimitNPROC=4096
LimitAS=infinity
TasksMax=4096
# Logging
StandardOutput=journal
StandardError=journal
SyslogIdentifier=luminari
[Install]
WantedBy=multi-user.target