Reputation: 45
I have a python discord bot, and I want to make it auto start whenever the raspberry pi boots up.
The current way I am making the bot not close whenever I close the ssh session is with tmux.
How do I make the tmux auto-start on boot, and then run a python file in it?
Thank you.
Upvotes: 0
Views: 835
Reputation: 3063
I have this in my .bashrc to launch tmux, and attach to a session I call 'main' (and create if it that session doesn't already exits)
# Launch tmux
if command -v tmux>/dev/null; then
[[ ! $TERM =~ screen ]] && [ -z $TMUX ] && tmux new-session -A -s main
fi
Then I assume it's not difficult to put a command to run a python file straight after this.
Upvotes: 2