Rahmat S. Masror

MSCS, BBA, DIT, MCSE, CCNA, COM TIA+, 3CX Engineer

IT Expert

Freelancer

IT Consultant

Server/Database Expert

3CX Advanced Certified Engineer

Rahmat S. Masror

MSCS, BBA, DIT, MCSE, CCNA, COM TIA+, 3CX Engineer

IT Expert

Freelancer

IT Consultant

Server/Database Expert

3CX Advanced Certified Engineer

Blog Post

Clear cache memory and set cronjob on Linux server

June 1, 2013 Posted in CPANEL/DIRECTADMIN
Clear cache memory and set cronjob on Linux server

Below is the command to clear memory cache :-

[root@root~]#  sync; echo 3 > /proc/sys/vm/drop_caches

Use the above command in cronjob using screipt

Login your server as a root user.

Then use it in script at “/root/cleacrcache.sh” and enter folllowing contents

    #!/bin/sh
    sync; echo 3 > /proc/sys/vm/drop_caches

Make  the permission of ” /root/cleacrcache.sh” to 755

[root@root~]#  chmod 755  /root/cleacrcache.sh

Run the cronjob using  crontab file as below :-

  [root@root~]#  crontab -e  OR
    [root@root~]# Vi /var/spool/cron/root

Enter below  cron  to set cronjob for clearing cache in every hour

   0 * * * * /root/clearcache.sh

Restart crond service

[root@root~]#  /etc/init.d/crond restart

Thats it you have done :)

Write a comment

Need Help For Web Hosting ?

I’m Here To Assist You

Looking For Secure Web Hosting ?

Do you need a secure website and official emails hosted under most secure data centers, firewall protected servers?