no message

master
zcy 2021-07-29 00:17:41 +08:00
parent 486c4ec4e8
commit c0e60bfd55
1 changed files with 49 additions and 2 deletions

View File

@ -1,13 +1,56 @@
/*
* @Author: your name
* @Date: 2021-07-23 23:39:57
* @LastEditTime: 2021-07-26 23:49:33
* @LastEditTime: 2021-07-29 00:14:47
* @LastEditors: Please set LastEditors
* @Description: In User Settings Edit
* @FilePath: \generallib\general\src\function\daemon.c
*/
#include "daemon.h"
#ifdef linux
void _process_start(string path){
auto file = popen(path.c_str(),"r");
if(file < 0){
fprintf(stderr,"execl failed:%s",strerror(errno));
return;
}
pclose(file);
}
int prep_map(){
FILE *pstr;
char cmd[128],buff[512],*p;
int iPID;
const char *name= "mongod";//要查找的进程名
int pidPosition=1;
int pInfoPosition=7;
memset(cmd,0,sizeof(cmd));
sprintf(cmd, "ps ");
pstr = popen(cmd, "r");
if(pstr==NULL) {
return 1;
}
memset(buff,0,sizeof(buff));
while( 1 ) {
fgets(buff,512,pstr);
if(feof(pstr))
{
break;
}
printf("buffer=%s",buff);
}
pclose(pstr);
return 1;
}
#endif
#ifdef _WIN32
@ -244,6 +287,10 @@ int DaemonizeMonitor::StartMonitor(){
}
return 0;
#endif
#ifdef linux
#endif
}