I have a c program that executes another process (bash script) with fork and execlp. When I want to kill this process it moves to a zombiee state. Why is this??
Create a process:
switch (PID_BackUp= fork())
{
case -1:
perror("fork");
printf("An error has occurred launching backup.sh script!\n");
break;
case 0:
execlp("/usr/local/bin/backup.sh", "/usr/local/bin/backup.sh", NULL, NULL, NULL);
break;
default:
printf("backup.sh script launched correctly! PID: %d\n", PID_BackUp);
break;
}
Kill a process:
if(kill(PID_BackUp,SIGKILL)==-1)
fprintf(stderr, "No se ha podido matar el programa: %d\n", PID_BackUp);
else
printf("\nProceso con identificador %d, se ha abortado\n", PID_BackUp);
So at this point the process moves to a zombie state. What I am doing wrong?