Quote:
Originally Posted by wildwizard
This should do the trick :-
man 3 daemon
|
Hi..!
just take a look at this code...!
in shell programming...
it was something like...
!#bin/bash
while(true)
do
echo "Done"
done &
pid = $!
sleep 60 && kill TERM pid
i just tried converting a part of it to C....and i have a problem with that &...!
#include <stdio.h>
#include<string.h>
#include<stdlib.h>
#include<unistd.h>
#include <sys/types.h>
#include <signal.h>
int kill( pid_t pid, int sig );
int main()
{
while(1)
{
printf("\nDone");
}
sleep(60) && kill(getpid(),15);
}
and u told daemon will do that job...is it like within daemon function..this while should be put???
Not getting it