2

I work with a cluster that terminates idle processes after they have been idle for 24 hours but I want to leave tmux sessions running for multiple days so that they are still there when I come back to them.

Is there an easy way to make tmux wake up every two hours to prevent long spans of being idle? The only think I could think of was to write a script that executes an arbitrary tmux command every hour, e.g. tmux ls to see if that solves the problem, but I feel like there must be a more elegant way.

  • Cronjob is the best thing I can think of. Either that or (in a tmux session) run something like while sleep 2h; do echo alive; done (I'm assuming that will prod the pty subsystem and make tmux wake up; this assumption requires testing). – Tom Hunt Oct 28 '15 at 20:28
  • 1
    Or add clock to status bar and force it to update every so often -- superuser.com/questions/517402/force-update-for-tmux-status-bar – sendmoreinfo May 25 '16 at 23:33
  • Why does this keep getting voted down? There is nothing wrong with the question. It turns out that Tom's solution works @TomHunt if you post your comment as a solution I will accept it. – Mike Dacre Mar 8 '17 at 1:52
1

In order to wake tmux periodically, you can run the following in a tmux session:

while sleep 2h; do echo alive; done

Since tmux handles its sessions' terminals in its own code, this will wake it up to handle the output.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.