I am adding a piece of code which adds entry in crontab ((in brown color))
\crontab -l > $tmpfile
echo "Removing the cleanProcess entry if it already existed.."
grep -v "cleanProcess.sh" $tmpfile > $newtmpfile
lcnt=`grep -c "cleanProcess.sh" $tmpfile`
echo "Number of entries in cron is : $lcnt"
if [ $lcnt -eq 0 ]; then
echo "Entry didn't exist before. Adding new...."
echo "\n" >> $newtmpfile
else
echo "Entry already existed. Replacing it..."
fi
echo "0,5,10,15,20,25,30,35,40,45,50,55 * * * * $/test/bin/cleanProcess.sh" >> $newtmpfile
crontab $newtmpfile
echo "Added the new entry.."
crontab is empty ==>
$> crontab -l
$>
but file is having string as follows :
\n
echo "0,5,10,15,20,25,30,35,40,45,50,55 * * * * $/test/bin/cleanProcess.sh"
becoz of that the crontab is not able to initialized properly .
any anybody help me out whats wrong with it?