How to create a new process, then kill it
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/types.h>
#include <signal.h>
int main()
{
pid_t p = fork();
if (p == 0) {
printf("This is the child before exec");
int r = execl("/usr/local/bin/mpg123",
"/usr/local/bin/mpg123",
"/home/djm/audio/lemon_lane.mp3");
}
sleep(5);
kill(p, SIGTERM);
return 0;
}
