#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>

main()
{
  char str[10], *res; int x,i,pid;
  FILE *fd=fopen("/home/me/Desktop/pipe","r");

    res=fgets(str,10,fd);
    x=atoi(str);
    if(x!=0) {
       printf("Adding %d children under init.\n", x);

      }
     if(x==0){
        printf("Stopping daemon.\n");
        return 0;
     }


    for(i=0;i<x;i++){
        if(fork()){
            exit(0);
        }if(!fork()){
            sleep(15);
            exit(0);
            }
        }wait(0);



    //return 0;

  }


