Page 1 of 1
Need to Clear Cache all time
PostPosted:26 Jul 2018 22:40
by glauciolacerda
On some of my servers, especially those that get traffic from facebook ads, they stay out of the air while. When I see this happening, I need to go to VPSSIM and give it a Clear All Cache. After that, the sites return to normal functioning. Is there any way for the server to do this clear all automatic caching from time to time, or some plugin that I install and do this?
Re: Need to Clear Cache all time
PostPosted:27 Jul 2018 08:08
by nguyenoanh
Hello !
You can create a bash /home/clearcache.sh
Content:
Code: Select all#!/bin/bash
service nginx restart
service php-fpm restart
# ( echo "flushall" ) | redis-cli #Clear Redis Cache / uncomment to use command
# echo "flush_all" | nc 127.0.0.1 11211 #Clear Memcached Cache / uncomment to use command
Save and make it can run
And using
Cronjob Manage in VPSSIM menu to add this to cronjob
Code: Select all* */12 * * * root /home/clearcache.sh
=========================================================================
VPSSIM - Manage VPS/Server by VPSSIM.COM
=========================================================================
Cronjob Manage
=========================================================================
Cronjob running: 1
=========================================================================
How to use: http://go.hostingaz.vn/howcronjob
=========================================================================
1) Add Cronjob 4) Backup All Current Cronjobs
2) Delete Cronjob 5) Restore Cronjob From Backup File
3) Clear All Cronjobs 6) Cronjob running
Type in your choice (0-Exit): 1
=========================================================================
Example: To add Cronjob: * */5 * * * /root/backup.sh
-------------------------------------------------------------------------
You must type in: * */5 * * * /root/backup.sh
-------------------------------------------------------------------------
Type in Cronjob [ENTER]: * */12 * * * root /home/clearcache.sh
This cronjob run every 12 hours
Re: Need to Clear Cache all time
PostPosted:27 Jul 2018 20:04
by glauciolacerda
[root@minhas_pbns_1 ~]# nano /home/clearcache.sh
[root@minhas_pbns_1 ~]# chmod +x nano /home/clearcache.sh
chmod: cannot access ‘nano’: No such file or directory
Re: Need to Clear Cache all time
PostPosted:27 Jul 2018 20:05
by nguyenoanh
Oh, sorry.
Error on copy
I have updated the post.
Re: Need to Clear Cache all time
PostPosted:27 Jul 2018 21:48
by glauciolacerda
Thanks for your fast support. Love VPSSIM
Re: Need to Clear Cache all time
PostPosted:27 Jul 2018 21:55
by nguyenoanh
You're wellcome
Re: Need to Clear Cache all time
PostPosted:28 Jul 2018 00:13
by pauloficaadica
nguyenoanh wrote: ↑27 Jul 2018 08:08
Hello !
You can create a bash /home/clearcache.sh
Content:
Code: Select all#!/bin/bash
service nginx restart
service php-fpm restart
# ( echo "flushall" ) | redis-cli #Clear Redis Cache / uncomment to use command
# echo "flush_all" | nc 127.0.0.1 11211 #Clear Memcached Cache / uncomment to use command
Save and make it can run
And using
Cronjob Manage in VPSSIM menu to add this to cronjob
Code: Select all* */12 * * * root /home/clearcache.sh
=========================================================================
VPSSIM - Manage VPS/Server by VPSSIM.COM
=========================================================================
Cronjob Manage
=========================================================================
Cronjob running: 1
=========================================================================
How to use: http://go.hostingaz.vn/howcronjob
=========================================================================
1) Add Cronjob 4) Backup All Current Cronjobs
2) Delete Cronjob 5) Restore Cronjob From Backup File
3) Clear All Cronjobs 6) Cronjob running
Type in your choice (0-Exit): 1
=========================================================================
Example: To add Cronjob: * */5 * * * /root/backup.sh
-------------------------------------------------------------------------
You must type in: * */5 * * * /root/backup.sh
-------------------------------------------------------------------------
Type in Cronjob [ENTER]: * */12 * * * root /home/clearcache.sh
This cronjob run every 12 hours
Hey friend, I have had some problems like this, I didn't know it was because of the cache.
If this can happen with frequency, would it not be better for this setup the default cache cleanup to be available on a self create by the VPSSIM
Like as an extra option to schedule cleaning of the cache. And then just add the time in hours for this to be done.
It may be a great idea.
Thank you!
Re: Need to Clear Cache all time
PostPosted:28 Jul 2018 08:22
by nguyenoanh
I will think about it.
Thanks.
Re: Need to Clear Cache all time
PostPosted:03 Aug 2018 11:31
by datecom
Code: Select all#!/bin/bash
service nginx restart
service php-fpm restart
# ( echo "flushall" ) | redis-cli #Clear Redis Cache / uncomment to use command
# echo "flush_all" | nc 127.0.0.1 11211 #Clear Memcached Cache / uncomment to use command
em muốn hỏi có nên restart 2 dịch vụ không bác Oánh? bởi em chỉ muốn xóa cache thôi, còn restart dịch vụ sẽ dẫn lỗi truy cập thời điểm kết nối đó
Re: Need to Clear Cache all time
PostPosted:03 Aug 2018 12:38
by nguyenoanh
datecom wrote: ↑03 Aug 2018 11:31
Code: Select all#!/bin/bash
service nginx restart
service php-fpm restart
# ( echo "flushall" ) | redis-cli #Clear Redis Cache / uncomment to use command
# echo "flush_all" | nc 127.0.0.1 11211 #Clear Memcached Cache / uncomment to use command
em muốn hỏi có nên restart 2 dịch vụ không bác Oánh? bởi em chỉ muốn xóa cache thôi, còn restart dịch vụ sẽ dẫn lỗi truy cập thời điểm kết nối đó
Bạn muốn xóa cache nginx và php thì để nguyên, không thì comment nó lại