check procee id exists
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了check procee id exists相关的知识,希望对你有一定的参考价值。
check exists, return 0
$ pgrep httpd
46775
$ kill -0 46775
$ echo $?
0
check non-exists, return 1
$ kill -0 999999899
bash: kill: (999999899) - No such process
$ echo $?
1
kill process id stored in .pid file
#!/bin/sh
pid_file=/var/run/process.pid
kill -0 $(cat $pid_file) 2>/dev/null
if [ $? -eq 0 ]; then
kill $(cat $pid_file)
fi
以上是关于check procee id exists的主要内容,如果未能解决你的问题,请参考以下文章
git:Git fetch和git pull的区别, 解决Git报错:error: You have not concluded your merge (MERGE_HEAD exists).(代码片
No cache manager could be auto-configured, check your configuration (caching type is ‘CAFFEINE‘)(代码片