script/ shell脚本 callstack如何dump
来源:互联网 发布:chemist软件 编辑:程序博客网 时间:2024/05/19 22:27
将script加入到需要check的脚本中即可。例如需要check ins_all_mod.sh的callstack,将附档中script加入到其最后即可。
# FILE : sctrace.sh
# LICENSE : GPL v2.0 (only)# PURPOSE : print the recursive callers' list for a script
# (sort of a process backtrace)
# USAGE : [in a script] source sctrace.sh
#
# TESTED ON :
# - Linux, x86 32-bit, Bash 3.2.39(1)-release
# REFERENCES:
# [1]: http://tldp.org/LDP/abs/html/internalvariables.html#PROCCID
# [2]: http://linux.die.net/man/5/proc
# [3]: http://linux.about.com/library/cmd/blcmdl1_tac.htm
#! /bin/bash
TRACE=""
CP=$$ # PID of the script itself [1]
while true # safe because "all starts with init..."
do
CMDLINE=$(cat /proc/$CP/cmdline)
PP=$(grep PPid /proc/$CP/status | awk '{ print $2; }') # [2]
TRACE="$TRACE [$CP]:$CMDLINE\n"
if [ "$CP" == "1" ]; then # we reach 'init' [PID 1] => backtrace end
break
fi
CP=$PP
done
echo "Backtrace of '$0'"
echo -en "$TRACE" | grep -n ":" # using tac to "print in reverse" [3]
0 0
- script/ shell脚本 callstack如何dump
- Shell Script[Shell脚本]
- Android Native Dump CallStack
- 脚本(shell script)
- dump所有cpu的callstack
- Shell脚本设计(1)--初识Shell script
- android6.0/7.0 dump CallStack使用
- MySQL远程dump单表shell脚本
- mysql dump shell 脚本crontab 计划任务
- 增量dump mysql的shell脚本
- shell script 脚本传递参数的方法
- 十五. 第一个shell script 脚本程序
- C调用shell script脚本的方法
- shell script脚本传参小结
- 如何调试shell脚本
- 如何编写shell 脚本
- 如何执行shell脚本
- 如何编写shell脚本
- ZooKeeper典型应用场景一览
- 筋斗云框架:REST-RPC风格服务接口实例分析
- LeetCode 253. Meeting Rooms II(会议室)
- 多线程编程--NSOperation
- Zookeeper .Net客户端代码
- script/ shell脚本 callstack如何dump
- Mybatis条件查询
- halcon之threshold
- Eclipse4.4.2手动安装Veloeclipse-2.0.8
- Java 内存溢出(java.lang.OutOfMemoryError)的常见情况和处理方式总结
- WordPress配置文件wp-config.php详解
- Android中的requestWindowFeature()函数
- hadoop2.7.2基于centos完全分布式安装
- Spring+quartz实现自动任务调度