Run in the background even after logging off
If I execute this command
gzip -f -r * & would it continue to gzip the files after I disconnect from the vnc linux session? |
Quote:
|
Why do you use vnc?
Use a X server instead, it is better on all grounds (perf, multiuser collision, CPU usage, memory usage, bandwidth, scalability, monitoring etc...) Anyway, if you let the terminal open, the gzip will continue even after you close the vnc session, because there is no link between the vnc session and the gzip command. However, if you close the terminal, which is the parent process, the gzip will terminate. Use nohup if you want it to continue after the parent terminates. |
That's good to know!
Can you bring it back to the foreground after logging in again at a later time? |
Quote:
If you want the output of gzip after you close the terminal, you can't because the standard output of gzip is the terminal. What you can do is redirect the output to somewhere else and check that where you redirected it. gzip -f -r * 2>&1 >somewhere & |
Quote:
Code:
fg Code:
root@Manish:~# shutdown -h 20:00 & |
thanks manishsingh4u for the fg command that I didn't know.
apologies to geeman2.0 for telling you couldn't bring a command to the foreground. |
You can also use the nohup command.
When you log back on, a new shell is created which only knows about the child (job) processes that it has created. You can't re-connect to a child that was launched by another shell, even if that child is still running. If you want to capture and peruse its output, use the '>', '2>' directives to pipe the stdout/stderr output to a permanent disk file. |
Quote:
|
Quote:
regards, ...drkstr |
Heh, beat me to the punch. GNU screen is dead sexy, nothing more to be said. If only it'd clean my house....
|
Quote:
...drkstr |
Quote:
|
Quote:
Wanted something like this for the exact same purpose a little while ago. |
All times are GMT -5. The time now is 03:24 PM. |