Determine programmatically if a program is running
You can walk the pid entries in /proc and check for your process in either the cmdline file or perform a readlink on the exe link (The following uses the first method). #include <stdlib.h> #include <stdio.h> #include <string.h> #include <unistd.h> #include <dirent.h> #include <sys/types.h> pid_t proc_find(const char* name) { DIR* dir; struct dirent* ent; char* … Read more