No Hang Up. Run a command immune to hangups, runs the given command with hangup signals ignored, so that the command can continue running in the background after you log out.
SYNTAX nohup Command [Arg]...
'nohup' increases the scheduling priority of COMMAND by 5, this
gives a slightly lower priority.
If standard output is a terminal, it and standard error are redirected so that
they are appended to the file nohup.out; if that cannot be written to, they
are appended to the file $HOME/nohup.out. If that cannot be written to, the
command is not run.
If 'nohup' creates either nohup.out or $HOME/nohup.out, it creates it with
no "group" or "other" access permissions. It does not change the permissions
if the output file already existed.
'nohup' does not automatically put the command it runs in the background; you
must do that explicitly, by ending the command line with an '&'.
bash script that takes any simple command and runs it in the background. Logging output and error output to ~/launch The output files are suffixed with the date and time including nanoseconds so that two of the same command run in the same second won’t try to write to the same file.
#!/bin/bash mkdir -p ~/launch logfilename="${1##*/}_$(date +%F_%H:%M:%S,%N)" echo "== LAUNCH $@ ==" > ~/launch/${logfilename}_stdout.log echo "== LAUNCH $@ ==" > ~/launch/${logfilename}_stderr.log nohup "$@" >>~/launch/${logfilename}_stdout.log 2>>~/launch/${logfilename}_stderr.log &
“Love is a perky elf dancing a merry little jig and then suddenly he turns on you with a miniature machine gun” ~ Matt Groening
builtin - Run a shell builtin.
chroot - Run a command with a different root directory.
exec - Execute a command.
if - Conditionally perform a command.
nice - Change job scheduling priority.
screen - Multiplex terminal, run remote shells via ssh.
.source - Run commands from a file.
su - Run a command with substitute user and group id.