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?
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.
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!
Thank you that works
To set up a cron job in Plesk to clear the Magento cache every other day at midnight:
This will clear your Magento cache automatically every other day at midnight.