Files
king-arth-iot-devices/doc/setupAutostart.md
T
2026-10-30 01:23:33 +01:00

1.7 KiB

Autostart applications

sudo nano /etc/systemd/system/SwordMain.service
[Unit]
Description=IoT Service for Sword Station
After=network-online.target
Wants=network-online.target

[Service]
Type=simple
User=theUser
WorkingDirectory=/home/theUser/SwordMain
ExecStart=/home/theUser/SwordMain/run.sh
Restart=on-failure
RestartSec=5

[Install]
WantedBy=multi-user.target
chmod +x /home/theUser/SwordMain/start.sh
# Reload systemd
sudo systemctl daemon-reload
# Enable the service
sudo systemctl enable SwordMain.service
# start immediately
sudo systemctl start SwordMain.service
# check status
sudo systemctl status SwordMain.service

game $(pwd)/assets -b "mqtts://excaliburs-erben.de:8883" -t "outdoor/king-arthur/sword/" -p "awesomeexodusoutdooradventures" -u "exodususer"

Watchdog

sudo nano /etc/systemd/system/SwordWatchdog.service
[Unit]
Description=Network Watchdog for Sword
After=network-online.target
Wants=network-online.target

[Service]
Type=simple
# user root user
WorkingDirectory=/home/theUser/SwordWatchdog
ExecStart=/home/theUser/SwordWatchdog/watchdog.py
Restart=on-failure
RestartSec=5

[Install]
WantedBy=multi-user.target

WiFi Power

sudo nano /etc/systemd/system/wifi-txpower.service
# ..
sudo systemctl enable wifi-txpower.service
sudo systemctl start wifi-txpower.service
[Unit]
Description=Set WiFi TX Power limit to prevent overheating
After=network-online.target
Wants=network-online.target

[Service]
Type=oneshot
# Wait 15 seconds after network connects so the network manager doesn't overwrite it
ExecStartPre=/bin/sleep 15
ExecStart=/sbin/iwconfig wlan0 txpower 20
RemainAfterExit=yes

[Install]
WantedBy=multi-user.target