[opensuse] How start a remote job and detach the session, and re-connect later?
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hi, I have done this, but I don't remember how. :-o I want to start an ssh session, start a command, get out, and later connect again via ssh and pick up the still running program and output. - -- Cheers, Carlos E. R. -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.19 (GNU/Linux) iEYEARECAAYFAlIwtFYACgkQtTMYHG2NR9XphQCglOqvQR28TaT0XpPfdN7ZldIm IB4AnR6zsCADkqRhRJfUjMYm4qNE/760 =RRu3 -----END PGP SIGNATURE----- -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
Can you use screen? Something like - vi /path/to/the/shell/script.sh #!/bin/bash /usr/bin/screen -dmS myScreenSessionName /path/to/command/to/start/in/Session.sh and then call it via SSH - /usr/bin/ssh -l username servername /path/to/that/shell/script.sh & Then when you connect to the server later, you can do a `screen -r myScreenSessionName` Chris
"Carlos E. R." 09/11/13 1:20 PM >>> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
Hi, I have done this, but I don't remember how. :-o I want to start an ssh session, start a command, get out, and later connect again via ssh and pick up the still running program and output. - -- Cheers, Carlos E. R. -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.19 (GNU/Linux) iEYEARECAAYFAlIwtFYACgkQtTMYHG2NR9XphQCglOqvQR28TaT0XpPfdN7ZldIm IB4AnR6zsCADkqRhRJfUjMYm4qNE/760 =RRu3 -----END PGP SIGNATURE----- -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Wednesday, 2013-09-11 at 13:40 -0500, Christopher Myers wrote:
Can you use screen? Something like -
I thought about screen, but the manual says NAME screen - screen manager with VT100/ANSI terminal emu- lation I thought it was something else, a display manager for Xorg. I'll look again. - -- Cheers, Carlos E. R. (from 12.3 x86_64 "Dartmouth" at Telcontar) -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.19 (GNU/Linux) iEYEARECAAYFAlIwyyoACgkQtTMYHG2NR9X2bQCeISrxkGmsvBF1gyiF0cWwM/g1 vRMAnj0li+M1t+qA7Rzv9BdZilMXPxKB =Bz/+ -----END PGP SIGNATURE----- -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
El 11/09/13 15:19, Carlos E. R. escribió:
Hi,
I have done this, but I don't remember how. :-o
I want to start an ssh session, start a command, get out, and later connect again via ssh and pick up the still running program and output.
-- Cheers, Carlos E. R.
Use tmux. check out "byobu" which is an easy to use wrapper around tmux/screen. -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
* Cristian Rodríguez <crrodriguez@opensuse.org> [09-11-13 15:16]:
El 11/09/13 15:19, Carlos E. R. escribió:
I have done this, but I don't remember how. :-o
I want to start an ssh session, start a command, get out, and later connect again via ssh and pick up the still running program and output.
Use tmux. check out "byobu" which is an easy to use wrapper around tmux/screen.
I agree with using tmux, but no script is necessary. After starting a tmux session, detach from the session, <ctrl-b><d> to reattach the session from anywhere, ssh to the machine where the session resides and tmux new -t <session-name> I use tmux constantly to access a session attached (ssh) to four machines, email and a few log displays, constantly from anywhere using cygwin on a usb stick for windows or ssh from linux. -- (paka)Patrick Shanahan Plainfield, Indiana, USA @ptilopteri http://en.opensuse.org openSUSE Community Member facebook/ptilopteri http://wahoo.no-ip.org Photo Album: http://wahoo.no-ip.org/gallery2 Registered Linux User #207535 @ http://linuxcounter.net -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Wednesday, 2013-09-11 at 16:04 -0400, Patrick Shanahan wrote:
* Cristian Rodríguez > [09-11-13 15:16]:
Use tmux. check out "byobu" which is an easy to use wrapper around tmux/screen.
I tried byobu, but I find it confusing. Too much information on those status lines that I do not need.
I agree with using tmux, but no script is necessary.
After starting a tmux session, detach from the session, <ctrl-b><d>
to reattach the session from anywhere, ssh to the machine where the session resides and tmux new -t <session-name>
tmux seems simple enough. ssh machine tmux .... work <ctrl-b><d> to detach. exit ssh ssh machine tmux attach and you are back in. Interestingly, I can attach two xterms to the same tmux session. I guess I could use this for supporting someone remotely, on the same xterm, one local, one remote, so that they see what I type. My only problem is remembering NOT to use ctrl-d to exit ssh, it kills the tmux session. - -- Cheers, Carlos E. R. (from 12.3 x86_64 "Dartmouth" at Telcontar) -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.19 (GNU/Linux) iEYEARECAAYFAlI2xqYACgkQtTMYHG2NR9XHCACdFtERBpMluX1ex1UYsr+EBYLr iksAnihqV9lL/6FqAmFCD9wbxEAjPU9P =1kOQ -----END PGP SIGNATURE-----
On 09/11/13 20:19, Carlos E. R. wrote:
I want to start an ssh session, start a command, get out, and later connect again via ssh and pick up the still running program and output.
Does the repeat-connection needs to be with ssh? Within an ssh session, typing "~<C-z>" (that's the key with an tilde ~, and Ctrl-Z following) suspends the ssh session. One has an active shell back at the command issuing server then.[*] With the command "fg" one can resume the ssh session. Joachim [*] If one has several cascadet ssh sessions, it's an "interesting" game to guess the amount of tildes before <Ctrl-Z> that one needs to get at an intermediate ssh session. -- =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- Joachim Schrod, Roedermark, Germany Email: jschrod@acm.org -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Thursday, 2013-09-12 at 01:06 +0200, Joachim Schrod wrote:
On 09/11/13 20:19, Carlos E. R. wrote:
I have been unexpectly busy this afternoon to try any of the suggestions, and now it is almost 4 AM. Too tired to try. Maybe tomorrow. Thanks to everybody.
I want to start an ssh session, start a command, get out, and later connect again via ssh and pick up the still running program and output.
Does the repeat-connection needs to be with ssh?
Mmm... I didn't say that the client machine usually hibernates between sessions. The idea is to ssh-in, start something in an xterm with ssh, when needed hibernate or poweroff (the client side), and take again the same terminal hours or even days later.
Within an ssh session, typing "~<C-z>" (that's the key with an tilde ~, and Ctrl-Z following) suspends the ssh session. One has an active shell back at the command issuing server then.[*] With the command "fg" one can resume the ssh session.
Interesting! Not of use for me this time, I think, but interesting. I'll write all this in my notes, so that I remember next time. However, the choice of "~" is awkward in a Spanish keyboard: to type it I need "[Alt-gr][4]" (alt-gr is the right hand "Alt" key), so the entire combo becames more complicated.
[*] If one has several cascadet ssh sessions, it's an "interesting" game to guess the amount of tildes before <Ctrl-Z> that one needs to get at an intermediate ssh session.
Indeed...! I always wondered how to do that if needed. I never had to, but it is interesting to know.
- -- Cheers, Carlos E. R. (from 12.3 x86_64 "Dartmouth" at Telcontar) -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.19 (GNU/Linux) iEYEARECAAYFAlIxIKUACgkQtTMYHG2NR9VNYgCgh4KzQ5xOUQ+oIWS1oSXD1RFF EEUAn1gTyALHZAciFz7vpkbb10Yhftk3 =q+Kf -----END PGP SIGNATURE----- -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
On 09/12/13 04:02, Carlos E. R. wrote:
I want to start an ssh session, start a command, get out, and later connect again via ssh and pick up the still running program and output.
Does the repeat-connection needs to be with ssh?
Mmm... I didn't say that the client machine usually hibernates between sessions. The idea is to ssh-in, start something in an xterm with ssh, when needed hibernate or poweroff (the client side), and take again the same terminal hours or even days later.
Then it doesn't help; you'll need to use something like screen.
Within an ssh session, typing "~<C-z>" (that's the key with an tilde ~, and Ctrl-Z following) suspends the ssh session. One has an active shell back at the command issuing server then.[*] With the command "fg" one can resume the ssh session.
Interesting! Not of use for me this time, I think, but interesting. I'll write all this in my notes, so that I remember next time.
However, the choice of "~" is awkward in a Spanish keyboard: to type it I need "[Alt-gr][4]" (alt-gr is the right hand "Alt" key), so the entire combo becames more complicated.
Same here in Germany, it's [Alt-gr][+] on German keyboards.
[*] If one has several cascadet ssh sessions, it's an "interesting" game to guess the amount of tildes before <Ctrl-Z> that one needs to get at an intermediate ssh session.
Indeed...! I always wondered how to do that if needed. I never had to, but it is interesting to know.
Ever wondered why typing a ~ at the start of a line isn't output immediately? It's an ssh escape character. To see the possible options, type "~?" at the start of a line. Very important is also "~." to terminate a session if it hangs remotely and doesn't accept Ctrl-C, Ctrl-Z, or such. Cheers, Joachim -- =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- Joachim Schrod, Roedermark, Germany Email: jschrod@acm.org -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
Le 13/09/2013 00:35, Joachim Schrod a écrit :
Then it doesn't help; you'll need to use something like screen.
notice that you can't use X forwarding in screen, or better said detaching and closing stoips the forwarded appliaction (tested with xeyes) jdd -- http://www.dodin.org -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Friday, 2013-09-13 at 08:54 +0200, jdd wrote:
notice that you can't use X forwarding in screen, or better said detaching and closing stoips the forwarded appliaction (tested with xeyes)
That's a pity. - -- Cheers, Carlos E. R. (from 12.3 x86_64 "Dartmouth" at Telcontar) -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.19 (GNU/Linux) iEYEARECAAYFAlI2xQ0ACgkQtTMYHG2NR9XJNQCfRxZwmSZhrvPbkjAchU7f7cO4 3XcAnjrIfcvJScbp6c5xJfdn6yYEEZwN =M4+t -----END PGP SIGNATURE----- -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
participants (7)
-
Carlos E. R.
-
Carlos E. R.
-
Christopher Myers
-
Cristian Rodríguez
-
jdd
-
Joachim Schrod
-
Patrick Shanahan