1 |
On 05/10/14 05:34, meino.cramer@×××.de wrote: |
2 |
> Hi, |
3 |
> |
4 |
> for starting and running a script on a headless system for me "nohup" |
5 |
> works perfectly. |
6 |
> For interactive session via ssh screen/tmux turned out to be the |
7 |
> solution to detach from jobs started from the commandline. |
8 |
> Both are hints/help I received from the community here. :) |
9 |
> Thank you very much !!! :))) |
10 |
> |
11 |
> Since the screen/tmux thingie is THAT convenient I would like to start |
12 |
> this as the default when logging in via ssh. |
13 |
> I could write a script which is started by the shell (zsh) which in |
14 |
> turn is started as part of the login process. |
15 |
> Screen would start another shell and TADA!... |
16 |
> But this is an embedded system... |
17 |
> |
18 |
> The result should be a running screen session right after login via |
19 |
> ssh. |
20 |
> |
21 |
> Is there any "shorter path" to what I am trying to do -- without the |
22 |
> cascade of shells which do nothing but waiting of the child process to |
23 |
> end? |
24 |
> |
25 |
> Thank you very much in advance for any help! Have a nice Sunday! |
26 |
> |
27 |
> Best regards, |
28 |
> mcc |
29 |
> |
30 |
> |
31 |
|
32 |
you can auto-start a program of your choice directly from an ssh |
33 |
command. for example: |
34 |
$ ssh -t myhost screen -R -d |
35 |
will connect over ssh and then run screen to auto detach then reattach a |
36 |
running a screen or start a new one if not. |
37 |
you can of course name your screens so you can connect to |
38 |
mycompilewindow or mycleverideasvimwindow |
39 |
|
40 |
alternatively, and if you tend to use a mobile device for ssh you can |
41 |
but something like in your .bashrc |
42 |
if [ -n "$SSH_CLIENT" ] || [ -n "$SSH_TTY" ]; then |
43 |
screen -R -d |
44 |
fi |
45 |
|
46 |
which would check to see if ssh variables are set by openssh i.e. it is |
47 |
an ssh session and then run screen for you |
48 |
|
49 |
hth |