Controling jobs on UNIX systems | dbazone

Controling jobs on UNIX systems

Posted on February 6th, 2010 in Oracle on Linux , ,

UNIX  job monitoring and control facilities allows you to monitor the jobs executed on background and bring the jobs on foreground . Here I like to  described different command used to control your jobs on background as well as foreground.

Commands to control your jobs on UNIX systems

jobs -  This command check the status of the jobs in the current session. It shows the jobs executing on background also.

ps –u – This command check the status of processes including those from other sessions.

kill -9 %1 -  kill a job ( 1 is job number, preceding % sign) by job number

kill -9 PID – kill a process by PID (Process ID ) number

bg – Run the most recently stopped  job on the background

fg- Bring the most recently backgrounder job to foreground

fg %1 –Bring a job to foreground by specifying job number

Control-z – Stop foreground job and return you to shell prompt. Remember this will not kill the job

Difference between Foreground and Background jobs

Foreground job can interrupt using  keyboard input and signals such as Control-C from the controlling terminal, background jobs cannot. If your  are disconnected from your session, foreground jobs are terminated by a hang-up signal, while backgrounds jobs are not. Both foreground and background jobs can write to the controlling terminal.

How you can put a Job in the Background

To initiate a job in the background, you have to put an ampersand (&) at the end of the command line. For example if your script name is test.sh and want to execute on the background, then use the following command at the command line.

sh test.sh &

If you want to put a job in background, which is already running on foreground, then first stop the job by pressing control-Z and type bg command.

Read about monitoring background jobs on UNIX

Digg This
Reddit This
Stumble Now!
Buzz This
Vote on DZone
Share on Facebook
Bookmark this on Delicious
Kick It on DotNetKicks.com
Shout it
Share on LinkedIn
Bookmark this on Technorati
Post on Twitter

Related posts:

  1. Monitoring background Jobs on UNIX systems To monitor background jobs on UNIX, you can use the...
  2. Background jobs on Unix impact on System Performance Is your background jobs on Unix impact on System Performance?...
  3. Killing Oracle Sessions There are different ways to kill oracle sessions From  SQL*PLUS...
  4. Kill Oracle process from UNIX server In some scenarios , my database may be hung and...

Related posts brought to you by Yet Another Related Posts Plugin.

Published by Paresh Sarma

One Response to “Controling jobs on UNIX systems”

  1. Background jobs in Unix impact on System Performance | dbazone Says:

    [...] Read about job Control on UNIX systems [...]

Leave a Comment

Follow dbazonein on Twitter
Increase Google Page Rank