![]() ![]() (Mods, if you feel like this answer should be worked into another and then deleted, please feel free to do so. Using Mosquitto as an example here: tmux new-session -d -s my_session "bash -c 'mosquitto -c /etc/nf -p 1883 -v 2>&1 | tee /tmp/mosquitto_nodaemon.log'" The original example showed a more complex last argument to tmux new-session which will not only start the command and show its output inside of the session's first (and only) window, but also log the output to a file at the same time. Here's an example for crontab which will have top waiting for you once you connect ( tmux attach -t my_session) to my_session sometime after boot: tmux new-session -d -s my_session 'top' This should be true for most modern distributions, but your mileage may vary and it may not be available out of the box. My technique will work on any system which supports Cron's extension. So far, none of the answers here provide a way to make tmux inside of crontab work without requiring an additional script. So this is an attempt to do so and expand upon it. Over at another question I've been asked to add an answer here as well, containing one aspect of my answer there. When you boot your system you should see the sessions you created. See this for exampleĬreate a file tmux_startup in /etc/init.d/. The next step would be to create a script and run it on start-up. Send-keys -t SES3 "from numpy import zeros" C-m Set -g status off #NOTE: this will disable the status bar(green text in the bottom. Method 1: This is my favorite and I have been extensively using it.Ĭontent of the file #TMUX start-up script IPython 7.13.0 - An enhanced Interactive Python. I have found the other line you have in your config to be unnecessary. nf file, and that you have sourced the file by running tmux source .First make sure that you have set -g mouse on in your. Type 'copyright', 'credits' or 'license' for more information Here is a clarification of Mark Volkmanns answer. Now If you open SES1 in the new terminal window you will see ipython running and two commands executed. Tmux send-keys -t SES1 "from numpy import zeros" C-m # let us send some commands to the other session (Python for example) ![]() # create two new sessions SES1 and SES2 and detach them.(-d -s is important) Here is an example of how one can interact with an existing session.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |