Files
openbot/scripts/hosting/openbot.service
T
NBandClaude Opus 5.5 ac99196e66 Keep the modes of a hosted release after a boat wake (#4373)
`cp -a` makes each path 0700 and gives it its mode when its copy ends.
boat saved /opt/OpenBot/app and its 229 MB binary in that time, and a
cold wake gave them back with 0700, so openbot.service failed with 126.
Copy without the owner, so each path has its mode at once, and repair
wrong modes before each start for releases that an older script copied.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-01 21:02:54 +01:00

39 lines
1.8 KiB
Desktop File

# OpenBot on a hosted server. provision.sh replaces @SERVICE_USER@ and enables this unit. boat
# stop and resume work like a reboot, so the unit starts again on each wake. boat starts the desktop
# about 8 seconds before the enabled units, and OpenBot starts with it.
[Unit]
Description=OpenBot hosted server
Wants=network-online.target openbot-update-apply.service
After=network-online.target display-manager.service
# openbot-boat-pre-stop stops OpenBot before boat saves the disk, and makes this file so that nothing
# starts it again before the save. /run is empty at each boot.
ConditionPathExists=!/run/openbot-pre-stop
[Service]
Type=simple
User=@SERVICE_USER@
RuntimeDirectory=openbot
RuntimeDirectoryMode=0700
Environment=XDG_RUNTIME_DIR=/run/openbot
# As root (+), and OpenBot starts when it fails (-). It repairs the modes of the release, and installs
# the update request units when an older release moved this one into place; openbot-hosted-update
# says why.
ExecStartPre=-+/opt/OpenBot/hosted/openbot-hosted-update trigger
ExecStart=/opt/OpenBot/hosted/openbot-hosted-server
# Stops OpenBot before its virtual displays, so that it closes its database first.
ExecStop=/opt/OpenBot/hosted/openbot-hosted-server --stop
Restart=always
RestartSec=10
TimeoutStopSec=60
# Memory guards. The machine is small, and this unit holds OpenBot, its browser tabs and every agent
# process. The OOM killer of the unit acts before the kernel's own, so the desktop, sshd and the boat
# agent keep running. systemd sets -500 as root, before it changes the user; main then gives each
# process it starts 500, so the OOM killer picks an agent process before main. One killed agent does
# not stop the unit: the default policy "stop" would stop OpenBot too.
MemoryMax=90%
OOMScoreAdjust=-500
OOMPolicy=continue
[Install]
WantedBy=multi-user.target lightdm.service