|
|
June
2, 2003 -
How
to Execute a UNIX Command that will Continue
Running Even After you Log Out - The nohup
Command
|
When
working with the UNIX operating system,
there will be times when you will want to
run commands that are immune to log outs
or unplanned login session
terminations. This is especially
true for UNIX system administrators.
The UNIX command for handling this job is
the nohup (no hangup)
command.
Normally when you log out, or your session
terminates unexpectedly, the system will
kill all processes you have started.
Starting a command with nohup counters
this by arranging for all stopped,
running, and background jobs to ignore the
SIGHUP signal.
The syntax for nohup is:
|
nohup
command [arguments]
|
You may
optionally add an ampersand to the end of
the command line to run the job in the
background:
|
nohup
command [arguments] &
|
If you do not
redirect output from a process kicked off
with nohup, both standard output (stdout)
and standard error (stderr) are sent to a
file named nohup.out. This file will
be created in $HOME (your home directory) if
it cannot be created in the working
directory. Real-time monitoring of
what is being written to nohup.out can be
accomplished with the "tail -f
nohup.out" command.
Although the nohup command is extremely
valuable to UNIX system administrators, it
is also a must-know tool for others who run
lengthy or critical processes on UNIX
systems.
|
|
|
Learn
more...
If you are new to the UNIX or Linux
operating system and would like to learn
more about other frequently-used operating
system commands, you may want to consider
registering for LiveFire Labs' UNIX
and Linux Operating System Fundamentals
online training course.
If you already have a solid grasp of the
fundamentals but would like to learn more
about UNIX system administration, taking
our UNIX
System Administration course will
be beneficial to you.
Our innovative hands-on training model
allows you to learn
UNIX by completing hands-on
exercises on real servers in our Internet
Lab.
More
Tips...
· Popular
UNIX Tips from the Past
|
|
|
|
 |
 |
| |
Receive
the UNIX Tip, Trick, or Shell Script of the
Week by Email
|
|
|
|