Script to enter commands in a Tmux window
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.
I have not tried myself but this syntax seems like it might get you started.
Hope it helps.
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.
|All times are GMT -5. The time now is 04:49 AM.|