LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices



Reply
 
Search this Thread
Old 02-25-2004, 05:31 PM   #1
ftgow
Member
 
Registered: Aug 2003
Distribution: Slackware
Posts: 69

Rep: Reputation: 15
fg, jobs etc


Running Slack 9.1 has anyone gotten the program 'jobs' to list their "jobs?
it returns nothing, so I cant use the fg command to set my unreal server in the foreground.

ANy hints?
 
Old 02-25-2004, 05:39 PM   #2
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 23,005
Blog Entries: 11

Rep: Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903
Works for me ...

Code:
find / -iname "test*"
Ctrl-Z
bg
jobs
[1]+  Running                 find / -iname "erwin*" &
fg

Maybe you aren't discriminating between
a process you interactively started and
a daemon run by some other user?


Cheers,
Tink
 
Old 02-26-2004, 11:53 AM   #3
ftgow
Member
 
Registered: Aug 2003
Distribution: Slackware
Posts: 69

Original Poster
Rep: Reputation: 15
So I have to first take the program and hit ctrl z? That makes it appear in jobs? If so, will ctrl Z keep the program running after I log out, like the '&' shell command does.

What should I do to make my program stay their UNTIL I kill it, AND apear in the jobs thing so I can bring it to the foreground? Thanks.
 
Old 02-26-2004, 12:55 PM   #4
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 23,005
Blog Entries: 11

Rep: Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903
That's what bg and fg are for.

man bash
/JOB CONTORL



Cheers,
TInk
 
Old 02-26-2004, 01:09 PM   #5
Booster
Member
 
Registered: Sep 2003
Location: Ontario, Canada
Distribution: Gentoo, Suse
Posts: 59

Rep: Reputation: 15
Check your command line (or maybe the ini file) for your UT server - looks like it's set to "daemonize" - remove that option and it should run in your console.

It's been a while since I have run a server, but I think just running:

$ ./ucc server

should run the server in the foreground in your terminal
 
Old 02-26-2004, 11:02 PM   #6
ftgow
Member
 
Registered: Aug 2003
Distribution: Slackware
Posts: 69

Original Poster
Rep: Reputation: 15
Its unreal 1 run through wine.
And my man pages are not working. Can you copy that JOB CONTROL stuff for me?

Last edited by trickykid; 02-26-2004 at 11:27 PM.
 
Old 02-26-2004, 11:22 PM   #7
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 23,005
Blog Entries: 11

Rep: Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903
Quote:
And my man pages are not working. Can you copy that JOB CONTROL stuff for me?
How about re-installing them?
And don't forget the text-tools like
groff and nroff with them ...


Code:
JOB CONTROL
       Job control refers to  the  ability  to  selectively  stop
       (suspend) the execution of processes and continue (resume)
       their execution  at  a  later  point.   A  user  typically
       employs  this  facility  via an interactive interface sup-
       plied jointly by the system's terminal driver and bash.

       The shell associates a job with each pipeline.  It keeps a
       table  of  currently  executing  jobs, which may be listed
       with the jobs command.   When  bash  starts  a  job  asyn-
       chronously  (in  the  background),  it  prints a line that
       looks like:

              [1] 25647

       indicating that this job is job number 1 and that the pro-
       cess  ID  of  the  last process in the pipeline associated
       with this job is 25647.  All of the processes in a  single
       pipeline  are  members of the same job.  Bash uses the job
       abstraction as the basis for job control.

       To facilitate the implementation of the user interface  to
       job  control, the operating system maintains the notion of
       a current terminal process group ID.  Members of this pro-
       cess  group  (processes whose process group ID is equal to
       the current terminal process group ID)  receive  keyboard-
       generated  signals  such  as  SIGINT.  These processes are
       said to be in the foreground.   Background  processes  are
       those  whose process group ID differs from the terminal's;
       such processes are immune to  keyboard-generated  signals.
       Only  foreground  processes  are  allowed  to read from or
       write to the terminal.  Background processes which attempt
       to  read  from  (write to) the terminal are sent a SIGTTIN
       (SIGTTOU) signal by the  terminal  driver,  which,  unless
       caught, suspends the process.

       If  the operating system on which bash is running supports
       job control, bash contains facilities to use  it.   Typing
       the  suspend  character  (typically ^Z, Control-Z) while a
       process is running causes that process to be  stopped  and
       returns control to bash.  Typing the delayed suspend char-
       acter (typically ^Y, Control-Y) causes the process  to  be
       stopped  when it attempts to read input from the terminal,
       and control to be returned to bash.   The  user  may  then
       manipulate  the state of this job, using the bg command to
       continue it in the background, the fg command to  continue
       it  in  the foreground, or the kill command to kill it.  A
       ^Z takes effect immediately, and has the  additional  side
       effect  of causing pending output and typeahead to be dis-
       carded.

       There are a number of ways to refer to a job in the shell.
       The  character  % introduces a job name.  Job number n may
       be referred to as %n.  A job may also be referred to using
       a  prefix  of  the  name used to start it, or using a sub-
       string that appears in its command line.  For example, %ce
       refers to a stopped ce job.  If a prefix matches more than
       one job, bash reports an error.  Using %?ce, on the  other
       hand,  refers  to  any job containing the string ce in its
       command line.  If the substring matches more than one job,
       bash reports an error.  The symbols %% and %+ refer to the
       shell's notion of the current job, which is the  last  job
       stopped  while  it was in the foreground or started in the
       background.  The previous job may be referenced using  %-.
       In output pertaining to jobs (e.g., the output of the jobs
       command), the current job is always flagged with a +,  and
       the previous job with a -.

       Simply naming a job can be used to bring it into the fore-
       ground: %1 is a synonym for ``fg %1'', bringing job 1 from
       the  background  into the foreground.  Similarly, ``%1 &''
       resumes job 1 in the background, equivalent to ``bg  %1''.

       The shell learns immediately whenever a job changes state.
       Normally, bash waits until it is about to print  a  prompt
       before  reporting  changes  in a job's status so as to not
       interrupt any other output.  If the -b option to  the  set
       builtin  command  is  enabled,  bash  reports such changes
       immediately.  Any trap on SIGCHLD  is  executed  for  each
       child that exits.

       If an attempt to exit bash is made while jobs are stopped,
       the shell prints a warning message.  The jobs command  may
       then be used to inspect their status.  If a second attempt
       to exit is made without an intervening command, the  shell
       does  not  print another warning, and the stopped jobs are
       terminated.

Cheers,
Tink

Last edited by Tinkster; 02-26-2004 at 11:31 PM.
 
Old 02-26-2004, 11:28 PM   #8
trickykid
Guru
 
Registered: Jan 2001
Posts: 24,133

Rep: Reputation: 199Reputation: 199
Quote:
Originally posted by ftgow
Its unreal 1 run through wine.
And my man pages are not working. Can you copy that JOB CONTROL stuff for me?
http://man.linuxquestions.org can't be too hard to find the man pages online..

And PS, watch the language please. Thanks.
 
  


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 On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Stopped jobs AndeAnderson Debian 4 03-01-2005 01:15 PM
Freelance jobs? jrtayloriv General 3 01-26-2005 10:39 AM
Jobs Postings ppuru LQ Suggestions & Feedback 1 08-16-2004 11:23 PM
Jobs in Bash cire Linux - General 1 08-23-2003 06:13 AM
cron jobs Zyanid Linux - Software 0 08-27-2002 06:10 AM


All times are GMT -5. The time now is 05:52 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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration