-2

I have a Linux server containing the os version below:

Linux 2.6.32-220.7.1.el6.x86_64

I want to restart it in every 2 days, please help me, I want to do it via crontab.

Another help,

I used a code below to drop my memory caches in every hour.

0 * * * * /root/clearcache.sh

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

But 1st 15 in every hour my server remain so slow after cleaning the caches. My sites do not load during every hour in 1st 15 minutes.

In another way if I restart my server then also caches are removed. So I decided to restart my server in every 2 days to drop my caches.

Will it be helpful to restart? Or is there any other way to drop my memory caches that will not down my server?

user9517
  • 117,122

1 Answers1

8

To answer your headline question, in root's crontab

0 0 */2 * * reboot

would reboot your system at midnight every other day. There may be an extra reboot or an extra day between reboots for months with odd numbered days.

Having said that, dropping caches probably isn't the correct thing to do as they are generally used to speed things up. Have a look at some of the answers to this SF search which may be able to help you diagnose why your system is slow so you can fix the real problem.

user9517
  • 117,122