UNIX i “kill” komanda

Lepo objašnjenje : link1.
Dodatne informacije : link2.

SIG=SIGNAL – a signal is the means Linux uses for sending information between processes or between the kernel and a process.

Meni je najvažnije ovo :
0 SIGNULL Null Check access to pid
1 SIGHUP Hangup Terminate; can be trapped
2 SIGINT Interrupt Terminate; can be trapped
3 SIGQUIT Quit Terminate with core dump; can be trapped
9 SIGKILL Kill Forced termination; cannot be trapped (forced terminate)

15 SIGTERM Terminate Terminate; can be trapped (not forced terminate)
24 SIGSTOP Stop Pause the process; cannot be trapped
25 SIGTSTP Terminal stop Pause the process; can be trapped
26 SIGCONT Continue Run a stopped process

Ja najviše koristim “-9” 😉
Ako se kao PID procesa stavi “0” (bez navodnika) biće ubijeni SVI procesi sem par posebnih sistem procesa.
Ako se koristi “-3”, to za sobom ostavlja “dump” podataka u logu procesa koji je ubijen, ili će kreirati fajl sa imenom “core” koji će sadržati memory image procesa u trenutku kada je ovaj primio signal.

Kako izlistati koji su signali podržani na sistemu :
#kill -l
Opšta sintaksa :
#kill -SIGNAL PID

Čemu služi “trap” : Trap will allow us to trap some or all of these signals, and perform operations on the trapped signal (There might be situations when you don’t want users of your scripts to exit untimely using keyboard abort sequences, for example because input has to be provided or cleanup has to be done. The trap statement catches these sequences and can be programmed to execute a list of commands upon catching those signals).