pid_t getPIDbyName(char *ps_name) {
  FILE *fp;
  char *cmd = (char *)calloc(1, 200);

  sprintf(cmd, "pidof %s", ps_name);

  fp = popen(cmd, "r");
  fread(cmd, 1, 200, fp);
  fclose(fp);

  return atoi(cmd);
}
