Re: background process

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 12/20/18 2:36 PM, Patrick Dupre wrote:
> Hello,
> 
> I would like to run a process on a remote machine (login through ssh
> and then su) which will remian running even when I close the connection.
> 
> 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>

Or from ssh on your local machine:

	ssh user@remote-host "screen -d -m -S SomeIdentifier <command> <args>"

In the screen command, the "-d -m" means "run the command in a detached
session". The "-S SomeIdentifier" just gives the session an identifiable
name. For example, if I use

	-S TestScreen

I'd get something like:

	remote-machine> screen -ls
	There is a screen on:
	7391.TestScreen		(Detached)
	(other stuff)

Otherwise you'd get something like:

	7434.pts-11.prophead	(Detached)
	(other stuff)

To attach to the detached session, use "screen -r <sessionID>", in the
example case:

	remote-machine> screen -r 7391.TestScreen

Once you're attached to it, you can either "CTRL-C" to end the session
or simply detach again by hitting "CTRL-A" followed by the "D" key. See
"man screen" for details.

Note that if you put a space in the session identifier, you MUST enclose
it in quotes so the shell doesn't try to interpret it.
----------------------------------------------------------------------
- Rick Stevens, Systems Engineer, AllDigital    ricks@xxxxxxxxxxxxxx -
- AIM/Skype: therps2        ICQ: 226437340           Yahoo: origrps2 -
-                                                                    -
-         Microsoft Windows:  Proof that P.T. Barnum was right       -
----------------------------------------------------------------------
_______________________________________________
users mailing list -- users@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe send an email to users-leave@xxxxxxxxxxxxxxxxxxxxxxx
Fedora Code of Conduct: https://getfedora.org/code-of-conduct.html
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: https://lists.fedoraproject.org/archives/list/users@xxxxxxxxxxxxxxxxxxxxxxx



[Index of Archives]     [Older Fedora Users]     [Fedora Announce]     [Fedora Package Announce]     [EPEL Announce]     [EPEL Devel]     [Fedora Magazine]     [Fedora Summer Coding]     [Fedora Laptop]     [Fedora Cloud]     [Fedora Advisory Board]     [Fedora Education]     [Fedora Security]     [Fedora Scitech]     [Fedora Robotics]     [Fedora Infrastructure]     [Fedora Websites]     [Anaconda Devel]     [Fedora Devel Java]     [Fedora Desktop]     [Fedora Fonts]     [Fedora Marketing]     [Fedora Management Tools]     [Fedora Mentors]     [Fedora Package Review]     [Fedora R Devel]     [Fedora PHP Devel]     [Kickstart]     [Fedora Music]     [Fedora Packaging]     [Fedora SELinux]     [Fedora Legal]     [Fedora Kernel]     [Fedora OCaml]     [Coolkey]     [Virtualization Tools]     [ET Management Tools]     [Yum Users]     [Yosemite News]     [Gnome Users]     [KDE Users]     [Fedora Art]     [Fedora Docs]     [Fedora Sparc]     [Libvirt Users]     [Fedora ARM]

  Powered by Linux