I am trying to daemonize a process. I am calling the below mentioned function wen ever a flag is set. The thing is I am not able to terminate the process after my use. I tried pressing ctrl+c to no avail. I tried closing the terminal, bu the process still runs in the background. The only way i can stop the process from running was by restarting the system. Is there any way to terminate the process without restarting my system?
Code:
void Daemonize(){
parent_id = fork();
if(parent_id!=0){
printf("Daemonized \n");
exit(0);
}
setsid();
}
Last edited by a moderator: