What's the difference between systemctl stop and systemctl kill?
systemctl kill supports sending a custom signal to the process, e.g. -9 (SIGKILL) instead of -15 (SIGTERM). So, is the only difference that systemctl kill is a more general version of systemctl stop, i.e. systemctl stop always sends -15 (SIGTERM)?
As an example, systemctl stop and systemctl kill have the same result for ssh.service (sshd):
systemctl stop:
$ systemctl stop sshd
$ systemctl status sshd
● ssh.service - OpenBSD Secure Shell server
Loaded: loaded (/lib/systemd/system/ssh.service; enabled; vendor preset: enabled)
Active: inactive (dead) since Mon 2021-11-08 09:09:32 CET; 1s ago
Docs: man:sshd(8)
man:sshd_config(5)
Process: 2086153 ExecStartPre=/usr/sbin/sshd -t (code=exited, status=0/SUCCESS)
Process: 2086154 ExecStart=/usr/sbin/sshd -D $SSHD_OPTS (code=exited, status=0/SUCCESS)
Main PID: 2086154 (code=exited, status=0/SUCCESS)
systemctl kill:
$ systemctl kill sshd
$ systemctl status sshd
● ssh.service - OpenBSD Secure Shell server
Loaded: loaded (/lib/systemd/system/ssh.service; enabled; vendor preset: enabled)
Active: inactive (dead) since Mon 2021-11-08 09:10:15 CET; 1s ago
Docs: man:sshd(8)
man:sshd_config(5)
Process: 2086486 ExecStartPre=/usr/sbin/sshd -t (code=exited, status=0/SUCCESS)
Process: 2086487 ExecStart=/usr/sbin/sshd -D $SSHD_OPTS (code=exited, status=0/SUCCESS)
Main PID: 2086487 (code=exited, status=0/SUCCESS)