OperationGoldenEagle

systemd help

Nov 27th, 2022 (edited)
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.17 KB | None | 0 0
  1. I'm trying to make systemd start my terraria server in a tmux session on boot.
  2. I've been trying for 2 days straight now, I really hope someone can help.
  3.  
  4. This is what I've tried so far:
  5.  
  6. [Unit]
  7. Description=Terraria
  8. After=network.target
  9.  
  10. [Service]
  11. Type=forking
  12. WorkingDirectory=/mnt/usb1/appdata/programmer/terraria
  13. User=argon
  14. Group=argon
  15.  
  16. ExecStart=/usr/bin/tmux new-session -s terra -d "./TShock.Server -world worlds/God_eftermiddag_.wld"
  17. ExecStop=/usr/bin/tmux send-keys -t terra-%i:0.0 "exit" C-m
  18. ExecStop=/bin/sleep 2
  19.  
  20. [Install]
  21. WantedBy=multi-user.target
  22.  
  23. When I save the above and do a systemctl daemon-reload and systemctl start terraria nothing happens.
  24. Running a systemctl status terraria.service gives the following output:
  25.  
  26. ● terraria.service - Terraria
  27. Loaded: loaded (/etc/systemd/system/terraria.service; disabled; vendor preset: enabled)
  28. Active: failed (Result: exit-code) since Sun 2022-11-27 10:43:05 CET; 3s ago
  29. Process: 220085 ExecStart=/usr/bin/tmux new-session -s terra -d ./TShock.Server -world worlds/God_eftermiddag_.wld (code=exited, status=0/SUCCESS)
  30. Process: 220091 ExecStop=/usr/bin/tmux send-keys -t terra-:0.0 exit C-m (code=exited, status=1/FAILURE)
  31. Main PID: 220087 (code=exited, status=0/SUCCESS)
  32. CPU: 64ms
  33.  
  34. Nov 27 10:43:05 argon systemd[1]: Starting Terraria...
  35. Nov 27 10:43:05 argon systemd[1]: Started Terraria.
  36. Nov 27 10:43:05 argon tmux[220091]: no server running on /tmp/tmux-1000/default
  37. Nov 27 10:43:05 argon systemd[1]: terraria.service: Control process exited, code=exited, status=1/FAILURE
  38. Nov 27 10:43:05 argon systemd[1]: terraria.service: Failed with result 'exit-code'.
  39.  
  40. I used to run a minecraft (java) server with an almost identical systemd file which works.
  41. So my guess is this is either do to dotnet (since terraria requires dotnet) or bash somehow.
  42.  
  43. I can send the working minecraft systemd file if it helps anything.
  44.  
  45. I'm running Raspberry Pi OS Bullseye 64-bit on a Raspberry Pi 4B+ 8GB RAM.
  46.  
  47. EDIT:
  48. In case someone should ask, yes - running the following line standing in the working directory works:
  49. tmux new-session -s terra -d "./TShock.Server -world worlds/God_eftermiddag_.wld"
Advertisement
Add Comment
Please, Sign In to add comment