#include main() { int x; x = check_server_process(); if (x ==1) printf ("server is running\n"); else printf("server is NOT running\n"); } /**************************************************** **** CHECK A PROCESS **** **** **** **** checks the process list and returns a 1 if **** **** Server process is running. **** ****************************************************/ int check_server_process() { FILE *fp; int audionum, anything; fp = popen("ps -e | grep java | grep -v grep","r"); anything = fscanf(fp,"%d",&audionum); if (anything) printf("the pid is %d\n", audionum); pclose(fp); return(anything); }