LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (http://www.linuxquestions.org/questions/linux-software-2/)
-   -   Script to enter commands in a Tmux window (http://www.linuxquestions.org/questions/linux-software-2/script-to-enter-commands-in-a-tmux-window-936344/)

Southpaw94 03-25-2012 11:58 AM

Script to enter commands in a Tmux window
 
Hello.

After a thorough and deep search lasting about an hour, I've come to the conclusion that this is either A) impossible, or B) so easy, nobody ever bothers to post about it. I'm very hopeful that it is the latter, though the former looks more likely at this point.

Anyways, I am generally trying to put together a bash script that will run as a crontab and communicate (or, send commands to) a window in a tmux session. Specifically, I want to run a backup script for my Minecraft server twice a day that will send save-all to window 0 (the window running the MC server) of session 0, then switch to window 1 and archive the map files.

My biggest problem, and the one that has served as a major roadblock, is getting the bash file, executed by cron, to enter the tmux session and navigate windows. After that hurdle, the remainder of the scripting should come pretty smoothly.

Is there anybody out there that has successfully set up a script like this and can get me going on one for my own use? Thank you in advance for your help.

-Geoffrey

jv2112 03-26-2012 04:49 AM

http://blog.hawkhost.com/2010/07/02/...hell-scripting


I have not tried myself but this syntax seems like it might get you started.

Hope it helps.

Southpaw94 03-26-2012 04:17 PM

Thank you for replying. At the current moment I have yet to try it, but it does appear to be what I am searching for. I will follow up with a reply later saying whether or not it worked.

Thanks again,
-Geoffrey


All times are GMT -5. The time now is 10:31 PM.