hi.. this is my first post here.. btw im making a daemon for processes...
is there a way that i can define if the process is null or not or there is another way to detect if it is up or not...
heres a sample of the code

Code:
for(;;)
{
fp = popen("cat /proc/*/status | grep 'httpd'", "r");

if(fp == NULL)
{
system("/etc/init.d/httpd start");
}else{
fpup = popen("cat /proc/loadavg", "r");
while(fscanf(fp, "%d ", &load) != EOF)
{
if(load > 4)
{
system("/etc/init.d/httpd restart");
sleep(180);
}
}
pclose(fpup);
}
pclose(fp);
return 0;
}
exit(EXIT_FAILURE);
when i run the daemon ans httpd is already up.. it starts httpd.. can someone help me? thanks..