I’m trying to read the all the PID from already executing processes with a specific name, saving does PID for later kill does process with a signal alarm every 45 seconds.
The problem comes when executing the execvp with the following parameters:
char* command = "ps";
char* argument_list[] = {"ps ", "-u|grep 'NAME_PROCESS'|grep -v 'grep'|awk '{print $2}'", NULL};
int status_code = execvp(command, argument_list);
The error that shows up is the following:
error: user name does not exist Usage: ps [options] Try 'ps --help <simple|list|output|threads|misc|all>' or 'ps --help <s|l|o|t|m|a>' for additional help text. For more details see ps(1).