On 20Dec2018 15:16, Dave Stevens <geek(a)uniserve.com> wrote:
On Thu, 20 Dec 2018 23:10:47 +0000
Rick Stevens <ricks(a)alldigital.com> wrote:
> I am not sure that a standard background process (using &) is not
> going to
> > kill the process when I logout.
>
> Make sure you have the screen RPM installed on the remote machine,
> then you can run the command in a screen session:
>
> remote-machine> screen -d -m -S SomeIdentifier <command>
> <args>
yes I use screen this way routinely, works fine.
I use tmux instead of screen, but yes this is my usual practice too.
Give your session a meaningful name, it will be handy later.
The recipes recited kick off a command already "detached" (running in
screen, but don't leave you connected). I generally open a named session
and start the command interactively. That lets me see it get under way
and lets me handle minor mistakes. And its in a shell ready to be
interrupted, suspended, restarted, whatever.
I do this so routinely that I've got an alias "@" which runs an
elaborate shell function, so I go:
@ remotehost:SESSION_NAME
whih sshes into remotehost in a tmux session named "SESSION_NAME". Once
it's good, just detach.
And it records the host and session in the local shell. So if I've just
got a shell lurking on my never-shut-down laptop, I kick that off. And
later, in that same shell, just type "@" to reconnect to the same
session.
Cheers,
Cameron Simpson <cs(a)cskk.id.au>