我实在不知道怎么描述这个标题,只好用英文写了。还是先说会儿闲话,从Kdump到Diskdump,然后又是Nedump,现在到Process dump,估计以后也离不开dump了。闲话说完了,贴上我的脚本吧o(∩∩)o...
- $ cat PCD.sh
- #!/bin/sh
- while true
- do
- echo "I'm still alive, will sleep now"
- sleep 60
- done
- $ cat runtest.sh
- #!/bin/sh
- ulimit -c unlimited
- sh PCD.sh &
- ID=`ps aux | grep PCD | sed '/grep/d' | awk '{ print $2 }'`
- kill -s 11 $ID
- if [ -f core.$ID ]; then
- echo "Success to core dump of process $ID"
- else
- echo "Failed to core dump of process $ID"
- fi
这个脚本满简单,运行一个Shell脚本,然后找到PID,再发个信号杀死之。具体的信息还是看man吧!
Tips:
man signal
man kill
阅读(4091) | 评论(0) | 转发(0) |