Timeline for On boot open tmux session and start continuous python script
Current License: CC BY-SA 4.0
7 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Jan 11, 2019 at 12:19 | comment | added | Ingo | @TravisMcgee You wrote: I am happy with having the service start the python program directly. Please make an answer to your solution. | |
Jan 10, 2019 at 5:11 | comment | added | Travis Mcgee |
If I change the shell script to: #!/bin/bash tmux new-session -d -s dropx 'python /home/pi/drop/dropx.py' then the script works if called from the terminal, it opens a new tmux session and runs the python program inside, however, when I use a Systemd service to start the same shell script it fails to run. I am happy with having the service start the python program directly. Thanks for all your comments
|
|
Jan 9, 2019 at 9:29 | comment | added | goldilocks♦ |
Ditto that the issue here is without -d tmux new-session is a blocking call. This may not be noticeable if you do it via a systemd service that itself goes to background -- in the background, it's still blocked.
|
|
Jan 9, 2019 at 9:20 | comment | added | Roger Jones |
Had a thought when clarifying the code: have you tried it with the -d flag as well? This prevents tmux from grabbing the terminal when creating the new session. Without it the rest of your script might not be running 'till after you've exited the tmux session...
|
|
Jan 9, 2019 at 9:13 | history | edited | Roger Jones | CC BY-SA 4.0 |
Tidy code a little and add more comments.
|
Jan 9, 2019 at 1:35 | comment | added | Travis Mcgee | Thank you very much, I will try playing with this tonight. I've seen multiple places where they show starting a tmux session and on the same line starting a python program in that window, for whatever reason, I can not get tmux to do this... I'll keep trying. | |
Jan 8, 2019 at 16:57 | history | answered | Roger Jones | CC BY-SA 4.0 |