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

Re: detaching a process from an ssh session ??



Thus spake Zenaan Harkness:
# The thing with this is that it terminates the backgrounded process.
# 
# Eg:
# 
# > ssh root@server
# # # run a long-running process, background it:
# # apt-move mirror
# # <CTRL-Z>
# # bg
# # # disconnect ssh:
# # ~.
# 
# All looks fine, except I go back in and check:
# > ssh root@server
# # ps aux|grep apt
# 
# and I get no output/ processes - and the CPU should be maxed out but
# it's on zero; I'm guessing the process must have been killed.

Try running it through screen instead:

> ssh root@server
# # run a long-running process in screen and detach it:
# screen apt-move mirror
# <CTRL-A>DD

The <CTRL-A>DD will detach the screen terminal and all its running processes
and automatically disconnect your ssh session.  if you go back and look for the
process you will still find it running.  You may, however need to grep for
screen, although apt should still show it.  You will also notice that the CPU
will be maxed as expected.  Once the process finishes, screen will automatically
terminate, so there is no need to go back in and terminate it manually.

HTH,
PRINCE

Attachment: signature.asc
Description: Digital signature


Reply to: