Suspending Jobs


Suppose you've just started a job that requires no input from yousay, downloading multiple files with ftpand you suddenly realize that you've got to finish something else right now. Instead of waiting for the files to download or stopping the job completely, you can instead just suspend the job and resume it later (Code Listing 9.5). In doing so, you can make the Unix system work your way that is, you don't lose the progress you've made toward getting the job done, and you can do the other stuff you need to do as well.

Code Listing 9.5. Suspending jobs is just like pushing the Pause button on your CD player.

[ejr@hobbes ejr]$ ftp calvin.raycomm.com Connected to calvin.raycomm.com. 220 calvin Microsoft FTP Service  (Version 2.0). Name (calvin.raycomm.com:ejr): anonymous 331 Anonymous access allowed, send identity  (e-mail name) as password. Password: 230 Anonymous user logged in. Remote system type is Windows_NT. ftp> [1]+ Stopped  ftp calvin.raycomm.com [ejr@hobbes ejr]$ 

To suspend a job:

  • While the job is running, press these keys to suspend the process (Code Listing 9.5). doesn't actually terminate the process; it pauses the job in much the same way that pressing the Pause button on your CD player pauses the CD.

Tips

  • After you've suspended a job, you can restart it in the background using bg, restart it in the foreground using fg, check on its status using jobs, or delete it completely using kill. Refer to the appropriate sections in this chapter for details on using these commands.

  • You can suspend as many jobs at a time as you want. Just use to do so, then use jobs to check the status of each suspended job if you need to.

  • Because it's pretty easy to forget that you've suspended a job, most shells will remind you that "there are stopped jobs" when you try to log out of the system. You should either resume the job or kill it before you can log out. Yes, the Unix system uses the terms "stopped jobs" and "suspended jobs" more or less interchangeably.





Unix(c) Visual Quickstart Guide
UNIX, Third Edition
ISBN: 0321442458
EAN: 2147483647
Year: 2006
Pages: 251

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net