Run a script inside screen using systemd inside LXC container

moi3879

New Member
May 14, 2026
5
0
1
Hello everyone,

I'm pretty new at proxmox and I'm trying to setup a video game server inside an LXC container.

My goal is to build a server that run at startup, auto-save every week, and end when stopping the machine. That's why I looked after systemd.
I use screen because it seems simple to me to attach and detach screens.

So I have a "bootserver" service :
Code:
[Unit]
Description=boot server
After=network.target

[Service]
Type=simple
RemainAfterExit=yes
TimeoutStartSec=90

ExecStart=/usr/bin/screen -DmS mcserver server/bootserv.sh

ExecStop=/usr/bin/screen -p 0 -S mcserver -X stuff "stop\015"
ExecStop=/bin/sleep 20

[Install]
WantedBy=multi-user.target

When y run systemctl start bootserver, the service start and exit but there's no screen session using screen -ls
I've got this status
Code:
● mcserver.service - boot server
     Loaded: loaded (/etc/systemd/system/mcserver.service; enabled; preset: enabled)
     Active: active (exited) since Thu 2026-05-14 10:55:03 CEST; 1s ago
 Invocation: e81a5ba203af4e2db2b3af7512cb9a40
    Process: 331 ExecStart=/usr/bin/screen -DmS mcserver server/bootserv.sh (code=exited, status=0/SUCCESS)
   Main PID: 331 (code=exited, status=0/SUCCESS)
   Mem peak: 1.7M
        CPU: 11ms

mai 14 10:55:03 lxc-deb-mc systemd[1]: Started mcserver.service - boot server.

Note that screen works well when I call it from terminal without using systemd.
Another point is I didn't create any user, so I'm working as root inside the LXC container.

Does someone know how I could run my script inside a screen session launched using systemd services ?
If it's not possible, is there another way to save my lxc server and have a backup on my NAS ?

Thank you all, have a good day/
 
Double post:
 
  • Like
Reactions: UdoB
Hello,
Oh damn. I get an error message when I tried to post yesterday, and I thought it failed. Sorry for the double post...