Operating System - HP-UX
1820884 Members
3598 Online
109628 Solutions
New Discussion юеВ

Re: disassociate terminal from a running process?

 
Doug O'Leary
Honored Contributor

disassociate terminal from a running process?

Hey;

I'm not sure this is possible, but, I've been wrong before, so it's worth a quick question:

HPUX 11.23, pa-risc:

A cohort kicked off a database restore process about three hours ago with an expected duration of another 10 hours - so restarting isn't exactly an option.

Is there anyway that he can kick his job into the background and disassociate his terminal so he can log off and go home before 0200 tomorrow morning?

Linux apparently has a disown command which I have to try out sometime; however, I haven't been able to find/think up anything that will help this poor schmuck.

Thanks for any tips/suggestions.

Doug O'Leary

------
Senior UNIX Admin
O'Leary Computers Inc
linkedin: http://www.linkedin.com/dkoleary
Resume: http://www.olearycomputers.com/resume.html
12 REPLIES 12
Doug O'Leary
Honored Contributor

Re: disassociate terminal from a running process?

My bad: if someone could move this to the sysadmin section, I'd appreciate it....

Doug

------
Senior UNIX Admin
O'Leary Computers Inc
linkedin: http://www.linkedin.com/dkoleary
Resume: http://www.olearycomputers.com/resume.html
Hakki Aydin Ucar
Honored Contributor

Re: disassociate terminal from a running process?

Hi,

I am not familiar 11.23 ,but if I get correct your issue, did you try
nohup command &
I use it in 11.11 works good, but I am not sure if it has a timeout somehow ?
Michael Steele_2
Honored Contributor

Re: disassociate terminal from a running process?

Ah Yep, for two decades now

nohup command &

is the one.
Support Fatherhood - Stop Family Law
Raj D.
Honored Contributor

Re: disassociate terminal from a running process?

Doug,

Check this out:

1. Suspend the forground job with Ctrl+z
2. Use bg command to push it to Background.
3. Verify with 'jobs' commnd , you will see the job runnig in background.


Example:
# find / -name abc -print


[1]+ Stopped find / -name abc -print
# bg
[1]+ find / -name abc -print &

# ps -ef | grep -i find
root 4289 4217 4 19:50 pts/2 00:00:01 find / -name abc -print
#


# jobs
[1]+ Running find / -name raj -print &
#
--------------------------------------------


Cheers,
Raj.
" If u think u can , If u think u cannot , - You are always Right . "
Raj D.
Honored Contributor

Re: disassociate terminal from a running process?

Doug,
However if you want to leave the terminal (log off) you have the only option to start the process with "nohup" as menoned above . Otherwise it will terminate the process with logoff, even it is in background.


Example:
# nohup command &
# exit

- From another session yo can verify with ps command.


Hth,
Raj.
" If u think u can , If u think u cannot , - You are always Right . "
Doug O'Leary
Honored Contributor

Re: disassociate terminal from a running process?

Hey;

I don't think I was clear; the process is already running and restarting it isn't really an option since it was already 3 hours into a 13 hour run. So, nohup ${cmd} is out.

I know about suspending the command and bg, however, if you log out, the process dies. I was hoping there was something like

nohup ${pid}

however, that obviously doesn't work.

As I expected, not possible to disassociate the terminal from an already active program...

Thanks for the responses.

Doug

------
Senior UNIX Admin
O'Leary Computers Inc
linkedin: http://www.linkedin.com/dkoleary
Resume: http://www.olearycomputers.com/resume.html
dirk dierickx
Honored Contributor

Re: disassociate terminal from a running process?

'screen' is excellent for this, ofcourse now it is to late. i'm not aware of attaching already running processes to a new screen.

still worth checking out:
http://en.wikipedia.org/wiki/GNU_Screen
Hakki Aydin Ucar
Honored Contributor

Re: disassociate terminal from a running process?

You are clear to me now, but I do not know a solution for this problem, if I haapen to find a way I will notify you. By the way ,if you find a solution please share with us here.
Dennis Handly
Acclaimed Contributor
OldSchool
Honored Contributor

Re: disassociate terminal from a running process?

"Linux apparently has a disown command which I have to try out sometime; however, I haven't been able to find/think up anything that will help this poor schmuck."

"disown" is a bash shell builtin...and not linux-dependent. If you've installed bash, *and* he/she is using that shell, it should work.

If they are using one of the std issue shells on HP-UX, then unfortunately that user is S.O.L... All of the alternatives available require that you take some action at the time the command is issued....
Dennis Handly
Acclaimed Contributor

Re: disassociate terminal from a running process?

>OldSchool: "disown" is a bash shell builtin and not linux-dependent. If you've installed bash, *and* he/she is using that shell, it should work.

I'm not sure how? If the HP-UX kernel doesn't support, there is no way bash can.
OldSchool
Honored Contributor

Re: disassociate terminal from a running process?

Dennis: "I'm not sure how? If the HP-UX kernel doesn't support, there is no way bash can."

Rash assumption on my part that bash was bash no matter where it runs. The man page says that it removes items from the "jobs table". Doesn't mention that that requires OS support.

I merely noted that it's *not* a separate executable, but a bash builtin. Having noted that, I'd expect bash to behave identically on all installations unless specifically noted otherwise.....

So much for expectations....