simple tip to keep a server running smooth

Started on the old forum in February 2012 · view the original in the archive · old links redirect here

2 replies · 940 views · started 14 years ago · 1 min read

2 participants
djdevil89 Senior · 287 posts #1

before i start note this WONT WORK ON A VPS

okay lets start the command is quite simple

echo 3 > /proc/sys/vm/drop_caches

many of you will ask what does it do? simple it clears the ram cache for example here i have it where i did it

root@ns1 [~]# free -m
             total       used       free     shared    buffers     cached
Mem:     7993       7839        154          0         62       6804
-/+ buffers/cache:        971       7021
Swap:         2046          0       2046
root@ns1 [~]# echo 3 > /proc/sys/vm/drop_caches
root@ns1 [~]# free -m
             total       used       free     shared    buffers     cached
Mem:     7993        885       7107          0          2         45
-/+ buffers/cache:        837       7156
Swap:         2046          0       2046
root@ns1 [~]# 

please not the numbers under "used" first it says used 7839 then it says used 889

now we dont want to have to do this everytime do we?

so we open up a shell console as root and type

crontab -e

this will open a editor with all cronjobs running as root now we past this in

*/10 * * * * echo 3 > /proc/sys/vm/drop_caches

this will run the command every 10 minutes and your ram stays nice and clean which speeds the server up 🙂 have fun

foreach ($_SERVER as $server => $value)
{
echo "$server is $value<br />";
}
djdevil89 Senior · 287 posts #3

you are very welcome

foreach ($_SERVER as $server => $value)
{
echo "$server is $value<br />";
}

Sign in to reply.

Similar topics

Keyboard shortcuts

g f
Go to forums
g h
Go to your feed
g m
Go to messages
r
Reply (in a topic)
/
Search
j
Next post
k
Previous post
?
This list
Ctrl/⌘ + Enter
Send what you are writing
Ctrl/⌘ + B / I
Bold / italic while writing
Esc
Close