I'm a bit of a beginner and I'm trying to figure out how to keep my tmux socket from closing. I've set up a tmux session that starts at boot using a service file that runs a shell script. This script creates a tmux session to host a Hytale server. To manage the server, I also have a scheduled shutdown using another service that sends messages to players before the server goes down. However, I'm getting an "error connecting to /tmp/tmux-0/default (No such file or directory)" message when I try to send commands to tmux. It seems that if I maintain an SSH connection for a while after boot, the socket stays open, but I'm not entirely sure if that's true. Is there a way to ensure the tmux session remains active for input, or do I need to consider a different approach? Also, I can share my service files and scripts if that would help!
3 Answers
It sounds like your setup is on the right track! Just to clarify, when you start the session, make sure to use a command like "tmux new -s hytale" to name it. Also, double-check your service files—if the scripts are running as a user rather than system-wide, they might have issues accessing the right tmp directory. Post those scripts here if you can, and I can help spot any potential issues!
You should definitely name your tmux session instead of using the default. This helps avoid confusion in the future if you create more sessions. Also, could you share the details of your service and timer units? It's important to know if you're running them in a user context or system context, as that could be affecting the socket behavior. Some setups might create separate /tmp directories for security, which could explain the connection issues you're facing.
You seem to have a solid grasp of the situation! If you keep an SSH connection for a while after boot, that indeed might keep the tmux socket alive. To make things easier, consider using tmux's built-in session management features more robustly. Also, remember to check the permissions and environment variables for your services—they can sometimes trip things up.

Related Questions
Can't Load PhpMyadmin On After Server Update
Redirect www to non-www in Apache Conf
How To Check If Your SSL Cert Is SHA 1
Windows TrackPad Gestures