linux kill children process
来源:互联网 发布:小米6数据断流官方回应 编辑:程序博客网 时间:2024/06/07 20:09
最近做项目,需要写脚本,根据某一个process id kill 掉该进程以及其下的所有子进程。
代码如下:
#!/bin/sh
root=$1
if [[ -z $root ]]; then
echo "No PID Given."
exit;
fi
treekill()
{
local father=$1
# children
children=`ps -ef| awk '$3 == '$father' { print $2 }'`
if [ ${#children[@]} -ne 0 ]
then
for child in ${children[*]}
do
treekill $child
done
fi
# father
kill -9 $father
#echo " $father killed !"
}
treekill $root
- linux kill children process
- Linux kill a process
- linux kill process
- kill process in linux
- linux命令温故而知新:kill process
- Linux 常用命令,show/kill process
- kill a process by name on Linux
- Kill Process
- kill process
- kill process
- kill process
- Kill Process
- FIND AND KILL PROCESS BY ONE COMMAND IN LINUX
- Kill Process in Linux or Terminate a Process in UNIX / Linux Systems
- Kill Process in Linux or Terminate a Process in UNIX / Linux Systems
- kill Oracle process
- Python kill process
- Android Kill Process
- subtitile in DVB
- 通过注册表获取硬件信息
- startActivityIfNeeded 何时 不启动 activity ?
- Unity3D总结:关于射线碰撞
- SQL中CONVERT函数的使用
- linux kill children process
- Linux 开发环境工具
- wchar_t*转char*(宽字节字符串转多字节字符串)
- ngx_save_argv方法详解
- 一个程序员一月的开销统计分析、(附上PC端和移动端android源码)
- hdu3639 Hawk-and-Chicken
- QTP-对象-SystemUtil对象
- 移动硬盘恢复数据丢失能找回吗
- 2013.11.29 JFinal + DWZ 将文件上传到工程中的某个指定文件夹下