Hi ,
Following are the two scripts :-
Script 1)
#!/bin/sh
cp file.log file.log.1
Script 2)
#!/bin/sh
diff file.log file.log.1 > DIFFERENCE.log
cp file.log file.log.1
grep "ERROR" DIFFERENCE.log
if [ $? -eq 0 ]; then
echo "1"
else
echo "0"
fi
The first script is just to run once and afterwards we have to run the second script.The first script will make just a copy of original log file so that whenever we seek for the recent error , we can run the second script.The second script will compare the original file with the copied one and whenever the new entries will come in original file with word error , it will display it. If no error will come then it will display only 0, means no recent error came. The second script will check for the fresh logs , that is why the we need to copy the whole script at leats once in a life time
Now I want to combine these two scripts into one in such a manner that the first script runs only once in a lifetime and the other keeps on running after a fixed interval of time.
Kindly suggest how to combine these two ?
I have to recall the first script withing the second script .
Regards