cancel
Showing results for 
Search instead for 
Did you mean: 

Magento Clear Cache Cron

Highlighted

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?

2 REPLIES 2
Highlighted

Re: Magento Clear Cache Cron

@CraigLambo 

 

Easiest way, 

 

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

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

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

Manish Mittal
https://www.manishmittal.com/
Highlighted

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

Or
For setup cron tab kindly refer below link :
https://www.mageplaza.com/kb/how-to-configure-cronjob-schedule-tasks-magento-2.html

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