Automate the purging of the repository cache (Exalytics Linux)

So we have created a ram disk and you are now storing the repository cache, how can we automate the purging.
1.  First we will create a file that we can run that will 1st load the BI environment, then we will clear the cache :
–          Create a file called purge.txt with the following contents:
Call SAPurgeAllCache();
–          Create a file called with the following contents
cd /u01/app/oracle/product/fmw/instances/instance1/bifoundation/OracleBIApplication/coreapplication/setup
. ./
cd /u01/app/oracle/product/fmw/Oracle_BI1/bifoundation/server/bin
./nqcmd -d “AnalyticsWeb” -uweblogic –p<place the password here> -s/home/oracle/TT_INSTALLERS/purge.txt
2. Update crontab to execute the file everyday:
00 23 * * * /home/oracle/TT_INSTALLERS/ > /home/oracle/TT_INSTALLERS/purged.log 2>&1
You now have automated purging of your cache.