Gentoo Archives: gentoo-user

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