Start tmux and execute a set of commands on boot
9,530
In my case, I have a user account just for the purpose of running one single script, so I provide a default tmux configuration in that user's home directory by creating a file ~/.tmux.conf
My ~/.tmux.conf file looks (roughly) like this:
new-session -d -s MYSESSIONNAME
set -g status off
new-window ~/my-startup-script.sh
my-startup-script.sh needs to have the +x permission set, obviously.
To start the ~/.tmux.conf tmux script, issue the command
tmux start-server
Related videos on Youtube
Author by
boolean.is.null
Updated on September 18, 2022Comments
-
boolean.is.null over 1 year
I'm trying to find a way to have tmux start for a specific user on boot. The tmux session should run two Python scripts.
I think I could start Python as mentioned here, but I'd rather have it in a tmux session.
Is that possible and how could I accomplish that?
-
Valentyn about 3 yearsHow can I test if this works? I have created a ~/.tmux.conf file with just one line 'new-session -d -s tower', when I run 'tmux start-server', nothing happens. I don't see any new session created with 'tmux ls'.
-
am05mhz almost 3 yearswhen system rebooted, does the tmux auto start session run under root user or else?