0

I'm currently running an automatic service with the following content:

Description=Valheim Dedicated Server

[Service]
User=steam
Group=steam
ExecStart=/opt/steam/valheim/start_server_bepinex.sh
Restart=on-failure

[Install]
Wants=network-online.target
After=network-online.target
WantedBy=multi-user.target

I would like to change the service to do the following:

  1. Start a tmux session > tmux new -s Valheim
  2. Login as the "steam" user > su -ls /bin/bash steam
  3. Run a shell script > /opt/steam/valheim/start_server_bepinex.sh

I tried the following, but it doesn't work:

Description=Valheim Dedicated Server

[Service]
User=steam
Group=steam
ExecStart=tmux new -s Valheim '/opt/steam/valheim/start_server_bepinex.sh'
Restart=on-failure

[Install]
Wants=network-online.target
After=network-online.target
WantedBy=multi-user.target

The script executes a server that has to be accessed in real time in order to manage it through the terminal, so I need an active session and it has to be maintained under the steam user, not as a root. I need to be able to access this session whenever I want.

Adephx
  • 3
  • 4

0 Answers0