#include<stdio.h>
int main()
{
FILE* file;
char buffer[128]={\0};
char* cmd="ps -elf|grep xxx|grep -v grep";
file=poen(cmd."r");
fgets(buffer,128,cmd);
if(strstr(buffer,"xxx")!=NULL){
printf("program is running!\n");
}
else{
printf("program is not running!\n");
}
printf("buffer=%s\n",buffer);
return 0;
}
守护进程之判断程序是否在运行
最新推荐文章于 2022-08-10 10:56:02 发布