Ok that worked, although I had to add two things to my cron scripts. I
had to make sure my environment variables were sourced before running
tmux and I had to stagger the start-up of my cron scripts using sleep.
Apparently tmux can't handle multiple scripts hammering it all at once
at start-up. It would only create a session for one script randomly
out of the five scripts that cron was trying to run. I staggered my
scripts five seconds apart, and so far they have booted up smoothly
each time. Thanks for your help!

Here is the updated crontab script for anyone attempting to do
something similar:

#!/bin/bash

# Wait to start, tmux kludges if all sessions run at once in cron.
# next script would be sleep 10 ...
/bin/sleep 5

# Set up the paths and environmental variables to run tmux config.
source /home/xtuser/.bashrc

# Start the tmux session
/usr/bin/tmux new-session -d -s mysession

# Set up the paths and environmental variables to run script.
/usr/bin/tmux send-keys -t mysession "source /home/user/.bashrc" C-m

etc...

---------------------------------
Donavan Kienenberger
V-ADAPT Systems Administrator
Volcanic-Ash Detection, Avoidance
and Preparedness for Transportation



On Tue, Dec 3, 2013 at 1:43 PM, Nicholas Marriott
<nicholas.marri...@gmail.com> wrote:
> These will all race against each other. If you want them to run in parallel
> you need to specify -t to all commands or the send-keys will probably go to
> whatever session started most recently.

------------------------------------------------------------------------------
Sponsored by Intel(R) XDK 
Develop, test and display web and hybrid apps with a single code base.
Download it for free now!
http://pubads.g.doubleclick.net/gampad/clk?id=111408631&iu=/4140/ostg.clktrk
_______________________________________________
tmux-users mailing list
tmux-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tmux-users

Reply via email to