[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]
Re: How to "start" in RedHat
- From: Rick Stevens <rstevens vitalstream com>
- To: redhat-install-list redhat com
- Subject: Re: How to "start" in RedHat
- Date: Wed, 10 Dec 2003 13:49:05 -0800
M.Hockings wrote:
Rick Stevens wrote:
M.Hockings wrote:
Michael Ault wrote:
There is the nohup command or to run in background use
the "&" suffix for the command line.
# nohup runthis
or
# runthis &
Mike
=====
Michael R. Ault
Senior Technical Management Consultant
TUSC -- The Oracle Experts WWW.TUSC.COM
Thanks Michael,
The '&' did the trick !
Keep in mind the differences between "nohup", "bg" and "&".
"nohup" runs the program in the background and redirects its stdout and
stderr output streams to a "nohup.log" file in the current directory.
"bg" (available in the bash shell) allows a current foreground program
to be moved to the background, stdout and stderr remain directed at the
current terminal.
The "&" suffix launches the program in the background with stdout and
stderr directed to the current terminal
----------------------------------------------------------------------
- Rick Stevens, Senior Systems Engineer rstevens vitalstream com -
- VitalStream, Inc. http://www.vitalstream.com -
- -
- You know the old saying--any technology sufficiently advanced is -
- indistinguishable from a Perl script -
- --Programming Perl, 2nd Edition -
----------------------------------------------------------------------
Rick,
Thanks for the extra explanation, what would you recommend as a good
reference for this sort of thing. I tried googling for it but terms
like "nohup" didn't come to mind when thinking "start" ;-) An online
ref or a good book if you know of one you would recommend.
A google of "background +process +linux" would probably have worked
better.
As far as books are concerned, "Linux in a Nutshell" (O'Reilly) comes to
mind, as does "Running Linux" (also O'Reilly) and perhaps "Linux for
Dummies". Hit "http://www.oreilly.com" for details on O'Reilly books.
I tried the nohup after reading Michael's note but the console still
seemed to be suspended (i.e., I could not enter further commands) and
the '&' suffix seemed to get around this.
I should have been clearer. "nohup" doesn't actually background the
process. It redirects the stdout and stderr streams to "nohup.out" in
the current directory (if possible) or $HOME/nohup.out (your home
directory) and tells the program to ignore SIGHUP signals so the program
can continue to run if you log out. You must background the program
using "&" to release the terminal. So, the command is:
nohup command &
to run it in the background, redirect stdout and stderr to nohup.out and
ignore SIGHUP, and I think that's what you want to do.
This is trying to start
Seti Home at startup. I have a wee script that basically contains the
lines below and was attempting to launch it at startup time. Since I'm
already trying to discard the stdout and stderr output I presume that
the '&' will be fine. BTW, Without the '&' it is a wee bit distracting
for it to start and hog the console thus stopping the startup process.
But I was able to overcome that without even begging the list's
assistance -- what is the next step beyond Linux newbie ? newbie++
maybe ??
cd seti-home-dir
./setiathome -nice > /dev/null 2> /dev/null
A more, uh, "professional" command would be:
cd seti-home-dir;nohup ./setiathome -nice &
The redirections are unnecessary with "nohup". Should you wish to do
redirection, however, the conventional way to redirect stdout and stderr
to the same place is:
command >/dev/null 2>&1
">/dev/null" redirects stdout, "2>&1" redirects stderr to wherever
stdout is directed.
For full details on nohup, try "info nohup" (well, "man nohup", but it
tells you to "info nohup" as the full manual is an info file).
For details on background and foreground operations, "man bash" and then
"/ background" (search for the word "background") or "/ JOB CONTROL"
(search for the phrase "JOB CONTROL" in all capitals). For info on
redirection, "man bash" and "/ REDIRECTION".
If you want setiathome to run automatically at boot, add this to the end
of the "/etc/rc.d/rc.local" file:
/seti/home/dir/setiathome -nice >/dev/null 2>&1 &
obviously replacing "/seti/home/dir" with the actual directory it can be
found in.
----------------------------------------------------------------------
- Rick Stevens, Senior Systems Engineer rstevens vitalstream com -
- VitalStream, Inc. http://www.vitalstream.com -
- -
- When you don't know what to do, walk fast and look worried. -
----------------------------------------------------------------------
[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]