How to keep program running after logout | Unix Linux Forums | UNIX for Advanced & Expert Users

  Go Back    


UNIX for Advanced & Expert Users Expert-to-Expert. Learn advanced UNIX, UNIX commands, Linux, Operating Systems, System Administration, Programming, Shell, Shell Scripts, Solaris, Linux, HP-UX, AIX, OS X, BSD.

How to keep program running after logout

UNIX for Advanced & Expert Users


Tags
linux, process, process memory, ttys, unix

Closed Thread    
 
Thread Tools Search this Thread Display Modes
    #1  
Old 11-03-2012
lepetal lepetal is offline
Registered User
 
Join Date: Oct 2012
Last Activity: 3 November 2012, 8:14 PM EDT
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
How to keep program running after logout

Hello everyone.
I am logged into a computer through ssh. I would like to run a program and have it keep running after I log out without screen (i forgot to run it).

For example:

Code:
ssh server
user/comp~$ top &
[1] 12021
exit

after that:

Code:
ssh server
user/comp~$ (something, maybe shell script) 12021

How can I do that except disown solution?
Sponsored Links
    #2  
Old 11-03-2012
Yoda's Avatar
Yoda Yoda is offline Forum Advisor  
Jedi Master
 
Join Date: Jan 2012
Last Activity: 22 October 2014, 8:12 PM EDT
Location: Galactic Empire
Posts: 3,387
Thanks: 235
Thanked 1,209 Times in 1,135 Posts

Code:
nohup <script> &

Sponsored Links
    #3  
Old 11-03-2012
lepetal lepetal is offline
Registered User
 
Join Date: Oct 2012
Last Activity: 3 November 2012, 8:14 PM EDT
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by bipinajith View Post
Code:
nohup <script> &

But you should use nohup before the script had run.

In my case, I just have run ssh, have run application & and exited from session. After that I have run ssh again and "ps aux | grep application" give me it's PID. I would like to attach this application to my new session. That's all.
    #4  
Old 11-03-2012
Yoda's Avatar
Yoda Yoda is offline Forum Advisor  
Jedi Master
 
Join Date: Jan 2012
Last Activity: 22 October 2014, 8:12 PM EDT
Location: Galactic Empire
Posts: 3,387
Thanks: 235
Thanked 1,209 Times in 1,135 Posts
Check out this link . It might help.
Sponsored Links
    #5  
Old 11-03-2012
bakunin bakunin is offline Forum Staff  
Bughunter Extraordinaire
 
Join Date: May 2005
Last Activity: 22 October 2014, 8:10 PM EDT
Location: In the leftmost byte of /dev/kmem
Posts: 4,286
Thanks: 45
Thanked 824 Times in 651 Posts
Quote:
Originally Posted by lepetal View Post
But you should use nohup before the script had run.
That depends on your OS. AIX's nohup, for instance, can take a PID as argument and disattach the process from the terminal even after the start. This is probably possible in some other OSes too.

I hope this helps.

bakunin
Sponsored Links
    #6  
Old 11-03-2012
lepetal lepetal is offline
Registered User
 
Join Date: Oct 2012
Last Activity: 3 November 2012, 8:14 PM EDT
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by bakunin View Post
That depends on your OS. AIX's nohup, for instance, can take a PID as argument and disattach the process from the terminal even after the start. This is probably possible in some other OSes too.

I hope this helps.

bakunin
Thanks At this point in the topic we are talking about Linux. In Linux we don't have -p key in nohup.
Sponsored Links
Closed Thread

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Help with Running More than One Program DTriniWay Shell Programming and Scripting 17 01-25-2010 03:23 PM
Keep process running on logout NathanWarden UNIX for Dummies Questions & Answers 3 12-12-2008 08:01 AM
Running app after logout and monitoring ncatdesigner Programming 1 04-21-2008 05:39 AM
Keep process running (wget) and logout mikey1090 Shell Programming and Scripting 3 02-15-2006 06:57 PM
Running a program perleo UNIX for Dummies Questions & Answers 3 08-23-2002 10:34 AM



All times are GMT -4. The time now is 12:31 AM.