CentOS 7下systemd是如何stop mysql服务的




但没有定义ExecStop参数,就是停止mysqld服务时执行的命令。systemd究竟是如何stop mysql服务的。




systemctl stop mysqld@replica02.service


global target;
global signal;

probe begin
        printf("%-6s %-12s %-5s %-6s %6s\n", "FROM", "COMMAND", "SIG", "TO",
probe nd_syscall.kill
        target[tid()] = uint_arg(1);
        signal[tid()] = uint_arg(2);
probe nd_syscall.kill.return
        if (target[tid()] != 0) {
                printf("%-6d %-12s %-5d %-6d %6d\n", pid(), execname(),
                    signal[tid()], target[tid()], int_arg(1));
                delete target[tid()];
                delete signal[tid()];



相当于执行了kill -15 127531,kill -18 127531两个命令



KillSignal参数可以指定停止进程时使用的信号,默认值为15 SIGTERM ,另外systemd会紧跟此信号再发送一个18 SIGCONT信号,以确保杀死已挂起的进程。

KillSignal=Specifies which signal to use when killing a service. This controls the signal that is sent as first step of shutting down a unit (see above), and is usually followed by SIGKILL (see above and below). For a list of valid signals, see signal(7). Defaults to SIGTERM.

Note that, right after sending the signal specified in this setting, systemd will always send SIGCONT, to ensure that even suspended tasks can be terminated cleanly.


posted @ 2018-12-17 17:35  wangdong  阅读(127)  评论(0编辑  收藏