LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 02-16-2004, 12:37 AM   #1
jax8
Member
 
Registered: Feb 2004
Location: Australia
Distribution: Ubuntu, Fedora 10
Posts: 632

Rep: Reputation: 31
how to stop background job


Hi

I was wondering how to stop a background job

I can use kill, jobs, bg, fg, but stop %jobnumber will not work, it says that the command cannot be found

I am using RED HAT 9

thanks
 
Old 02-16-2004, 01:43 AM   #2
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910
Quote:
but stop %jobnumber will not work
That's probably because there is no such thing.

You could always go for fg % and Ctrl-C... or,
if you know the name of the program running,
skill -TERM name

The thing is that the jobnumber is a
bash-builtin, while kill, for example, is a
stand-alone executable that will work in
any shell, and therefor doesn't know about
bash's numbers.


Cheers,
Tink
 
Old 02-16-2004, 02:11 AM   #3
jax8
Member
 
Registered: Feb 2004
Location: Australia
Distribution: Ubuntu, Fedora 10
Posts: 632

Original Poster
Rep: Reputation: 31
but what if I only want to stop a process in its track much like what happens when you type "ctrl+Z" on a foreground process. This does not kill the process becuase you cen resume it using "bg %jobnumber"

thanks
 
Old 02-16-2004, 06:12 AM   #4
UltimaGuy
Member
 
Registered: Aug 2003
Location: Chennai, India
Distribution: PCLinuxOS .92, FC4
Posts: 840

Rep: Reputation: 31
When you type Ctrl+Z on a process, it is not stopped. It is sent to the background where it runs merrily as ever. You can bring it to the foreground using fg jobnumber but that's a different story.
 
Old 02-16-2004, 12:32 PM   #5
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910
Quote:
Originally posted by UltimaGuy
When you type Ctrl+Z on a process, it is not stopped. It is sent to the background where it runs merrily as ever.
Nope ... it's actually suspended until you type bg.


Cheers,
Tink
 
Old 02-16-2004, 07:48 PM   #6
Thymox
Senior Member
 
Registered: Apr 2001
Location: Plymouth, England.
Distribution: Debian + Ubuntu
Posts: 4,358

Rep: Reputation: 57
I use kill pid or [b]killall appname[/n] and sometimes (for processes that don't respond, even to kill) kill -s 9 pid or killall appname -s 9 to kill background processes.
 
Old 02-17-2004, 12:59 AM   #7
UltimaGuy
Member
 
Registered: Aug 2003
Location: Chennai, India
Distribution: PCLinuxOS .92, FC4
Posts: 840

Rep: Reputation: 31
Quote:
Originally posted by Tinkster
Nope ... it's actually suspended until you type bg.
You're right, Guru .
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
changing variables from background job bobwall Programming 2 06-18-2005 02:28 PM
Sending a job straight to background detly Linux - General 4 02-02-2005 02:51 AM
Change background in solaris and Xterm background also EvilAngel Solaris / OpenSolaris 2 01-31-2005 11:25 AM
how to run any binary in background - background process tej Linux - Newbie 1 08-16-2004 12:27 AM
Stop xwmconfig from changing background color in .xinitrc??? Shay Slackware 1 12-04-2003 12:36 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 02:57 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration