How to continue running a script while offline? | Unix Linux Forums | Shell Programming and Scripting

  Go Back    


Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

How to continue running a script while offline?

Shell Programming and Scripting


Closed Thread    
 
Thread Tools Search this Thread Display Modes
    #1  
Old 06-26-2011
matteo86 matteo86 is offline
Registered User
 
Join Date: Jun 2011
Last Activity: 23 May 2012, 11:01 AM EDT
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
How to continue running a script while offline?

Hi there,
I'm not really stranger to Linux and shell scripting but I am to servers. Anyway, I usually run scripts on a shared science machine, accessible via ssh.
My scripts are usually run with mpi, e.g.

mpirun -np 16 ./my_script


the things after entering the science machine and running the script and I'd love to turn off the computer and mind my own business, which I can't since the script halts when I turn off the computer.

Any suggestions?
Sponsored Links
    #2  
Old 06-26-2011
yazu yazu is offline
Registered User
 
Join Date: Jun 2011
Last Activity: 15 December 2014, 11:26 AM EST
Location: From far
Posts: 987
Thanks: 21
Thanked 232 Times in 226 Posts
nohup should work:

Code:
nohup mpirun -np 16 ./my_script

Sponsored Links
    #3  
Old 06-26-2011
matteo86 matteo86 is offline
Registered User
 
Join Date: Jun 2011
Last Activity: 23 May 2012, 11:01 AM EDT
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
I got this error

nohup: ignoring input and appending output to `nohup.out'

?
    #4  
Old 06-26-2011
neutronscott's Avatar
neutronscott neutronscott is offline Forum Advisor  
script kiddie
 
Join Date: Jun 2011
Last Activity: 24 November 2014, 8:22 PM EST
Location: McMurdo Station, Antarctica
Posts: 822
Thanks: 28
Thanked 245 Times in 231 Posts
That's not an error message. That's success!
Sponsored Links
    #5  
Old 06-26-2011
sk1418 sk1418 is offline
Registered User
 
Join Date: Mar 2011
Last Activity: 8 March 2012, 11:08 AM EST
Posts: 236
Thanks: 1
Thanked 55 Times in 54 Posts
you may want to check "screen" or "tmux". both can do exactly what you want.
Sponsored Links
    #6  
Old 06-26-2011
matteo86 matteo86 is offline
Registered User
 
Join Date: Jun 2011
Last Activity: 23 May 2012, 11:01 AM EDT
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
but If type 'top' or 'ps' I can clearly see that I'm running anything .... mmmh
Sponsored Links
    #7  
Old 06-26-2011
methyl methyl is offline Forum Advisor  
Advisor
 
Join Date: Mar 2008
Last Activity: 25 November 2014, 5:09 PM EST
Posts: 6,396
Thanks: 287
Thanked 673 Times in 642 Posts

Code:
mpirun -np 16 ./my_script

Assuming that the script is suitable for running in background (i.e. it does not require a physical terminal or keyboard input):
The general syntax to background a script is to issue "nohup" and "&" (put process into background).

Code:
nohup /full_path_to_mpirun/mpirun -np 16 /full_path_to_my_script/my_script &

Within the processes it is advisible to redirect any output to unique named logfiles rather than defaulting to nohup.out.
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
Restart and then continue script wolfgangcs Shell Programming and Scripting 9 12-13-2010 11:55 AM
Doing a tail in a script and then return back and continue script markdark Shell Programming and Scripting 4 11-04-2010 04:05 PM
Server Staus offline to online -Shell script chowdary_m Shell Programming and Scripting 2 02-18-2010 07:52 AM
Continue Script when File Found Jose Miguel Shell Programming and Scripting 7 11-07-2006 08:43 PM
Process launched by user who logs out, continue running ? Browser_ice UNIX for Dummies Questions & Answers 2 08-08-2006 10:43 AM



All times are GMT -4. The time now is 11:19 AM.