HowTo: Raspberry start command on startup with tmux

What you want is to automatically start a script or programm when your raspberry pi boots. And you want so specify a user which is executing the process. Even better, you want to start it in a tmux session because this allows you to attach to the session and see whats going on. You are awesome. But you don’t know how to do it ? Simply follow this simple steps:


1. Create a bash script file (e.g. with: touch tmux_start).

2. Add the following lines to this file (e.g. nano

tmux new-session -d -s peter 'python /home/pi/'

This command will create a new tmux session called „peter“ and execute the command „python“.
Note: I used the total path.

3. Now we set up the autostart. On the raspberry pi one way is to enter a line in /etc/rc.local. Thats want we wanne do. (so: sudo nano /etc/rc.local) copy and paste this:

sudo -u pi bash /home/pi/ &

This command will execute a the bash script as user ‚pi‘.


Schreibe einen Kommentar

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert

Diese Website verwendet Akismet, um Spam zu reduzieren. Erfahre mehr darüber, wie deine Kommentardaten verarbeitet werden.