Artificial intelligent assistant

Does a service restart send a HUP? I have noticed that doing a service restart with something like: service sshd restart is very similar to doing something like: pkill -HUP sshd However the pkill would close my ssh session where the service restart would leave it open. This lead to my question and that is does a service restart send a true HUP like the pkill command? And if they do the same thing why does the service restart leave my ssh session open but the pkill closes it?

From `sshd(8)`:


specified in the configuration file. sshd rereads its configuration file
when it receives a hangup signal, SIGHUP, by executing itself with the


The difference between a service script and an indiscriminate `pkill -HUP sshd` as `root` is that the service script will only target the main `sshd` process, while the `pkill` will get that process and also any child `sshd` processes that have been forked off that parent. Example:


% ps axo pid,ppid,command | grep ssh'[d]'
1808 1 /usr/sbin/sshd
8066 1808 sshd: jdoe [priv] (sshd)
28968 8066 sshd: jdoe@ttypj (sshd)
%


`init(8)` (pid 1) has started the main `sshd` (pid 1808) and off that there's two child `sshd` processes for someone logged in (pids 8066 and 28968). `pkill` goes to all of these, while a service script would only send the `HUP` to pid 1808.

xcX3v84RxoQ-4GxG32940ukFUIEgYdPy 3cffc81a580394748d885eba76400659