How to find out who sent the 'signal-15'

https://access.redhat.com/solutions/360993

 SOLUTION 已验证 - 已更新 2017年七月19日09:14 - 

English 

环境

  • Red Hat Enterprise Linux (RHEL) 7
  • Red Hat Enterprise Linux (RHEL) 6
  • Red Hat Enterprise Linux (RHEL) 5

问题

  • System is getting rebooted automatically, some process is sending 'SIGTERM' signal.
  • How do I find out who sent a 'SIGTERM/Signal-15'?

决议

The following systemtap script can find out who sent the Signal-15:

  • Let's try the following:

Raw

#!/usr/bin/env stap

probe signal.send {
    if (pid_name == @1) {
        if (sig_name == "SIGTERM") {
            printf("%s(pid: %d) received a %s signal sent by %s(%d)\n", pid_name, sig_pid, sig_name, execname(), pid())
            exit()
        }
    }
}
  • Example:

Raw

$ stap sigcheck.stp sshd
sshd(pid: 34469) received a SIGTERM signal sent by bash(31815)
  • Please ensure the correct execname of the process is specified

  • For more info about SystemTap script please refer to the documentation.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值