Background Processing in Unix

January 21, 2012 | By

unix background processA mechanism used to run a program in the background, without input from a terminal or from the user. Also called detached processing.

To start a background process, end the command line with the ampersand (&); you do not have to wait for this background processing.

Both the Bourne shell and the C shell slow background processing, and on Unix systems with job control, the C and Korne shells provide additional commands for manipulating background processing.

If you forget to run a program in the background, you can stop it too. Using bg command to put the program into background and to restart it. You can bring the current background job to the foreground with the fg command, and if you have lots of jobs running at the same time, use the jobs command to list them by job number.

The best candidates for background processing are programs that do not require input from you, and those that do not write to the screen. If a program running in the background needs input from the keyboard, it stops and waits for that input, and it will wait and wait until you finally provide the input. A program that writes to the screen will do so even from the background, and if you are in the middle of doing something else, you may not be able to make sense of the output to a file and look at it later.

When putting several programs separated by semicolons into the background using the shell, remember to group them using parentheses; the shell puts the last command on the line into the background but always waits for the first.

Any background processes you have running are usually terminated when you log out from terminal. Use the nohup command to avoid this, or set up the job using cron and at.

This is the best practice in DBA services, especially when you are taking remote connection of database. Every database DBA should need to make this practice as routine practice.

If you need more help and guidance then you can join our Oracle DBA forums and start to take advantages.

Be Sociable, Share!

Tags: , , ,

Category: blog, blogging, database, dba service, oracle dba

Comments (1)

Trackback URL | Comments RSS Feed

  1. Damir Vadas says:

    “Use the nohup command to avoid this, or set up the job using cron”

    Or run in sccreen.
    :-)