LinuxQuestions.org
Did you know LQ has a Linux Hardware Compatibility List?
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices

Reply
 
Search this Thread
Old 03-25-2012, 11:58 AM   #1
Southpaw94
LQ Newbie
 
Registered: Feb 2009
Posts: 7

Rep: Reputation: 0
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
 
Old 03-26-2012, 04:49 AM   #2
jv2112
Member
 
Registered: Jan 2009
Location: New England
Distribution: Arch Linux
Posts: 718

Rep: Reputation: 102Reputation: 102
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.
 
Old 03-26-2012, 04:17 PM   #3
Southpaw94
LQ Newbie
 
Registered: Feb 2009
Posts: 7

Original Poster
Rep: Reputation: 0
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
 
  


Reply

Tags
scripting, tmux


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
tmux sending commands to individual panes casperdaghost Linux - Software 2 01-17-2012 09:57 PM
Less doesn't accept commands unless I press enter maya_maya Linux - Newbie 3 01-24-2010 09:42 PM
Creating a script that will log into root and enter password and then run commands. tananthulus Linux - Newbie 8 11-02-2009 05:37 PM
making a script that opens terminal and enter commands into that terminal Cinematography Linux - General 8 12-16-2008 10:34 AM
bash - how to launch a console window via script and execute commands in it? basd Programming 4 01-26-2008 08:51 PM


All times are GMT -5. The time now is 05:17 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration