Showing results for 
Search instead for 
Did you mean: 

Magento Clear Cache Cron

Magento Clear Cache Cron

I have a magento website running on ver. 2.2.1 which is hosted on Plesk server, I am looking at setting up a scheduled task (cron) to flush the magento cache every other day at midnight.


Is this possible and can anyone help with how I can set this up?


Re: Magento Clear Cache Cron



Easiest way, 


Just create a bash file, i.e. file and put this file on Magento root folder. Keep below content in this file:

php bin/magento cache:flush
* * * * * sh /home/magento/

Later on you can set like this according to your time.

Manish Mittal

Re: Magento Clear Cache Cron

Hi @CraigLambo 

Steps to setup cron tab as below:
run the following command line to update the cronjob table:

crontab -e 

Add the following lines to your crontab file:

*/1 * * * * php -c {php.ini_path} {magento_path}/bin/magento cron:run
*/1 * * * * php -c {php.ini_path} {magento_path}/update/cron.php
*/1 * * * * php -c {php.ini_path} {magento_path}/bin/magento setup:cron:run
*/1 * * * * php -c {php.ini_path} {magento_path}/bin/magento cache:flush

For setup cron tab kindly refer below link :

If issue resolve, please click on 'Kudos' & Accept as Solution!

Problem solved? Click Accept as Solution!