I want to build an interface, that, using ssh and tmux will be able to start/stop daemons.

My approach to start the daemon was:

tmux new-session -s myDaemonID -d /path/to/daemon/exec /path/to/daemon/config

stopping the daemon is as simple as:

tmux send-key -t myDaemonID C-c

(I need to send C-c, becose juste killing the session wouldn't make my daemon unsubscribe properly.

This works great, now I want to move on the network. We can here assume that path to the deamon and it's config are valid on the remote machine.

I noticed that, when started locally, I can kill my deamon using

ssh localhost tmux send-key -t myDaemonID C-c

However, I cannot manage to start it remotly. Doing so wont work, and I have no log/message/code that tells me what happens:

ssh localhost tmux new-session -s myDaemonID -d /path/to/daemon/exec /path/to/daemon/config

Any idea what I am missing here ?

  • It's not clear to me what is not working? What command did you try that did not work, and what was the error message? – meuh Mar 1 '18 at 15:43
  • the very last command in my question returns without error message, yet the session is not active and the daemon is not running – Amxx Mar 1 '18 at 15:44
  • You can try using tmux -v .... It will create 2 files tmux-* in the current directory of the command. This log is very verbose and not very comprehensible but may give a clue as to why it fails. You could also try ssh -t to use a pty, but I dont think it should need one. – meuh Mar 1 '18 at 16:01
  • @meuh Nice call! Using tmux -v I managed to see that the issue is with loading a shared library. ssh→tmux→deamon might not call my bashrc (where I update LD_LIBRARY_PATH) at any point – Amxx Mar 1 '18 at 17:15

Your Answer

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

Browse other questions tagged or ask your own question.