script to run repeatedly after a fixed interval of time

Hi ,

I am working on the following script . I want this script to run and scan the log file repeatedly after 3 hours. This script will run & scan just for the current date logs and after every 3 hours. Kindly advice what to add in this script for this purpose.

#!/bin/sh
diff common.log common.log.1 > DIFFERENCE.log
cp common.log common.log.1
grep "DEBUG" DIFFERENCE.log
if [ $? -eq 0 ]; then
echo "1"
else
echo "0"
fi

Regards

Learn to use crontab. This will let you schedule a job at intervals.

You can use cronjobs...

Crontab can help you
try 'man 5 crontab'