Signal
Bash Shell
By default, the Bash Shell ignores the SIGQUIT(3)
and SIGTERM(15)
signals,
so executing the following commands will not have any effect ($$
is the process ID of the current Shell).
If the SIGHUP(1)
signal is received, the Bash Shell will exit, but before exiting,
it will pass the SIGHUP
signal to all processes and scripts started by that Shell.
TRAP
The trap
command can be used to catch signals.
Catch Signals
The SIGINT
signal is the signal for Ctrl+C
.
Exit Signals
You can catch the signals when the script exits.
Remove Signals
Use --
to remove signals.
NOHUP
No Hang Up, processes or scripts started by this command will ignore the SIGHUP signal. In other words, even if the terminal exits, the processes or scripts started by that terminal will not exit.
By default, STDOUT
and STDERR
are redirected to nohup.out
.
It’s better to redirect it yourself.
Nice Value
A parameter that controls the priority of a process. The higher the nice
value, the lower the priority of the process, and the less CPU resources it is allocated.
Range
The nice
value ranges from -20
to 19
:
-20
: Highest priority.0
: Default priority.19
: Lowest priority.
Start Process Priority
Modify Process Priority
Permissions
- Regular users can only lower the priority of a process.
- Only root users can raise the priority of a process.