Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

'Foreground', 'Background' and Suspend

Status
Not open for further replies.

MagnumVP

IS-IT--Management
Jul 9, 2002
109
US
What is the difference between foreground, background and suspend?

How can I move a process between these states?
 
The "CTRL-Z" should put vi or other job into background (you get the prompt back) and then use "fg" you can bring the job back to foreground. The feature
works for csh and ksh.

The problem I encounter is that: on Solaris 2.7 under ksh, if I use "CTRL-Z" to suspend a vi job, the prompt is hang and I can not type anything in that window.

No problem to use "CTRl-Z" on Solaris 2.51 and 2.6, no problem on Solaris 7 under csh. And norproblem to use "CTRL-Z" to suspend most of jobs except vi.

what can you doing

job control doesn't work properly under ksh for vi:

editing a file using vi under ksh, after user types CTRL-Z, the terminal is hang.
##########
$vi file
(^Z)
"file" [New file]
[1] + Stopped (SIGTSTP) vi file
$
######################


kas with vi in suspend mode is not working when loggin is turned on for the /var filesystem.

Two Scenarios:
1.) when /var is the only filesystem that has loggin turned on, then vi in suspend mode brings a practically dead ksh. Problem cannot be recreated if loggin is turned on for any other filesystem

2.) When loggin is turned on for /var together with any other filesystem for example, /opt, again, vi in suspend mode brings up a good ksh.

regards ph

 
also, use the "jobs" command to see what jobs are running and in what state.

if you execute a command at the prompt without appending it with an anpersand &quot;&&quot;, you'll see the usual foreground behavior of executing a command, where the prompt disappers and any std-out is printed out to the console. If you get impatient with a job, <ctrl -z> will suspend it, which is cause it to stop running, but maintain it's PID.

Example

# tar -xf bigfile.tar bigdirectory
^z
suspended
# jobs
[1] + Suspended tar -xf bigfile.tar bigdirectory

-the bg or fg command will either bring it back to the forground (fg) to execute, or send it to the background (bg)

# bg %1
[1] tar -xf bigfile.tar bigdirectory

-issue the jobs command to see it running:

#jobs
[1] Running tar -xf bigfile.tar bigdirectory

Hope this helps.

-jared
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top