On 10/05/2016 01:31 PM, Rich Shepard wrote:
>    Starting a script to run in the background is simple: append '&' to the
> command line. When the script runs for a few hours and I forget to start it
> in the background (as I did today) I'd like to pause it (using ctrl-z) and
> continue running it in the background.
>
>    My web searches show how to start scripts running in the background and
> how to pause them prior to bring them back to the foreground, but I missed
> seeing a solution to pausing then continuing processing in the background.
>
>    Seems to me that I should be able to pause the running script (PID: 10952
> pts/0 S+ 0:00 sleep 15) or whatever the PID is when I pause the script, then
> run bg 10952 to re-start it in background mode. Is this correct?
>
> Rich

I don't do this extensively, but my solution is pretty straight forward:

$ bash ~/bin/some-script.sh
^Z
[1]+  Stopped                 bash ~/bin/some-script.sh
$ bg
[1]+ bash ~/bin/some-script.sh &

At this point it just runs in the background, but the caveat to mention 
is that I believe the terminal / shell that you executed the script in 
must stay open until the script completes, or it dies with the closing 
of the TTY.

dafr

_______________________________________________
PLUG mailing list
[email protected]
http://lists.pdxlinux.org/mailman/listinfo/plug

Reply via email to