by Claude Cantin
The UNIX operating system has a number of ways to process a number of programs for the same user, simultaneously. Programs can be run in the background, they can be run by cron, they can be run at a specific time using at, they can be run in the background without interruption on logout, or they can simply be run in the foreground, as an interactive job.
This chapter describes ways of running programs in some kind of batch process.
&: Background
Programs can be sent to the background to be processed, while the user keeps doing interactive work in the foreground. Sending a job to the background is done by ending the command line with an ampersand (&).
When a job is sent to the background, the prompt immediately reappears, allowing the user to continue work in the foreground. At completion of the background job, a message will be displayed, announcing termination of the process.
NOTE: before leaving UNIX, all jobs running in the background mode should be allowed to complete; if the terminal used was connected to a serial port of the UNIX system and background jobs were still running, attempting to leave UNIX would potentially hang the port and stop other users from using it!!
If jobs are to be allowed to continue running upon exiting the interactive UNIX session, then the batch command should have been used instead of the & function.