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

int ()
{

FILE *fin1;
FILE *fin2;
int flag=0;


while(1)
{
    
        system("wget -p http://www.cs.rmit.edu./students");

        system("cd www.cs.rmit.edu./");

    
    
   if(flag>0)
   {
    
    fin1=fopen("./watchtext/index.html","r");
    fin2=fopen("./watchtext/test2.txt","r");
    system("diff ./www.cs.rmit.edu./students/index.html ./watchtext/index.html | mail @cs.rmit.edu.");
    system("cp ./www.cs.rmit.edu./students/index.html ./watchtext/index.html ");
    system("md5sum ./www.cs.rmit.edu./images/*.* > ./www.cs.rmit.edu./test2.txt");
    system("diff ./www.cs.rmit.edu./test2.txt ./watchtext/test2.txt | mail @cs.rmit.edu.");
    system("cp ./www.cs.rmit.edu./test2.txt ./watchtext/test2.txt");
    system("rm ./www.cs.rmit.edu./test2.txt");
           
    fclose(fin2);
    fclose(fin1);   
   }    
  
    if(flag==0)
    {
     system("mkdir watchtext");     
     if((fin1=fopen("./watchtext/index.html","r"))==NULL)
     {
      system("cp ./www.cs.rmit.edu./students/index.html ./watchtext/index.html");
      system("md5sum ./www.cs.rmit.edu./images/*.* > ./watchtext/test2.txt");
      
      flag++;
      }
     
   } 
    
  
  
   printf("Running every 24 hours");     
  sleep(86400); 
  
}
 system("rmdir ./watchtext");      
}       
       
       
       
       








#include <stdio.h>	
#include <sys/time.h>

#include <strings.h>
#include <stdlib.h>
#include <ctype.h>



int () 
	{
	 FILE *fileopen;
  
	char *t_tst,chk[6]; 
    
	system("wget -p --convert-links http://www.cs.rmit.edu./students/");
	
  
	system("mkdir original");

  
	system("mv www.cs.rmit.edu./images/*.*  original/");

	system("mv www.cs.rmit.edu./students/*.* original/");
	

	sleep(75);

	system("wget -p --convert-links http://www.cs.rmit.edu./students/");
  
	system("mkdir two");
  
	system("mv www.cs.rmit.edu./images/*.* fresh/");

	system("mv www.cs.rmit.edu./students/*.* fresh/");
  
	system("diff one two > image_dif.txt");
  
	fileopen = fopen("imagedif.txt","r");
	t_tst = fgets(chk, 6, fileopen);
  
	if (strlen(chk) != 0)
     
	  system("mailx -s  \" WatchDog program has observed some Differences \" @.rmit.edu. < image_dif.txt");
	
		return 0;
	
}











