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,如何优...
给主人留下些什么吧!~~
评论热议
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,如何优...
给主人留下些什么吧!~~
评论热议
相关文章推荐
- How to know is the file exist in C++ - 在C++中如何判断文件是否存在
- How to count the number of threads in a process on Linux
- How to know one virtual machine is in which host?
- How to find PID of process listening on a port in Linux? netstat and lsof command examples
- What is EPOLL? EPOLL vs Select call? And How to implement UDP server in Linux using EPOLL?
- What is UMASK and how to set UMASK in Linux/Unix?
- What is EPOLL? Epoll vs Poll vs Select call ? And How to implement UDP server in Linux using EPOLL?
- How to write a Daemon process in Linux
- What is SGID and how to set SGID in Linux?
- How to know the port which process is using
- how to know wether an element is exist in a html page.
- How to change the resolution in text mode for Linux5+
- how to install mqtt in linux (Linux环境下安装mosquitto)
- How to setup tomcat in linux?
- Linux: How to enable root user in Gnome for VirtualBox Fedora?
- How To Set Up Port Forwarding in Linux
- What is a "sosreport" and how do I create it in Red Hat Enterprise Linux 4.6 and later
- How to Set and Unset Local, User and System Wide Environment Variables in Linux
- How to use git in Linux
- RunningMapReduceExampleTFIDF - hadoop-clusternet - This document describes how to run the TF-IDF MapReduce example against ascii books. - This project is for those who wants to experiment hadoop as a skunkworks in a small cluster (1-10 nodes) - Google Pro