您的位置:首页 > 运维架构 > Linux

how to know process is alive in linux?

2013-09-26 09:04 176 查看
A:
To send signal 0 to the process by pid, if the process is alive, it will return 0.

as signal 1 has a name HUP, signal 0 also has a name
EXIT. when a process exit normally, it send a signal 0. funcation
atexit take advantage of this signal, and use it to install cleanup
function. trap command in shell also use it to some cleanup.

another usage is use it to detect a process is dead or not, you can use kill command to test it.

for example:

$ ksh

$ sleep 10000&

$ kill -EXIT %% # detect, not actually kill

$ echo $? # if 0, the process is alive

$ kill %%

$ kill -EXIT %%

if you progamming in C, you can use kill routine.

阅读(274) | 评论(0) | 转发(0) |

0
上一篇:can't open samba file in ubuntu(solution)

下一篇:如何在Linux下安装双网卡详解

相关热门文章

linux 常见服务端口

【ROOTFS搭建】busybox的httpd...

什么是shell

linux socket的bug??

linux的线程是否受到了保护?...

关于enqueue 的dump 文件帮看...

tar --newer 05/12/2013 这个...

请教nginx代理tomcat作为子目...

LDAP安装 bus error是什么问...

select语句不修改sql,如何优...

给主人留下些什么吧!~~

评论热议
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: