Howto: Clear Swap Cache

Recently I’ve wrote a script to calculate the swap usage and triggered the alert when Swap usage hit the certain level.

And I found out the actual memory usage is not using as it is where swap still caching the usage. To clear the swap cache and make the memory usage only, you may turn of swap by selecting the swap drive.

First of all, you need to identify the swap disk. Check the blkid for more information.

blkid

Look at the entry of swap. Assume swap is in sda5.

Turn the swap cache off,

swapoff /dev/sda5

Once it is done, turn on again,

swapon /dev/sda5

Secure your WordPress by using WordPress File Monitor

I just read from an article from GHacks that there was mass shared host website get attack by base64 code through their major blogging application – WordPress, although they are using latest version of application.

To know how you get attacked by these coding, you may see your indexing file such as index.php from anywhere of your script contain javascript code with script tag and it is redirected somewhere that you have never know that website.

To secure your WordPress, Mick Genie will suggest you to install WordPress File Monitor. With this plugin, your folder and file could be scan either with the date modified or hash from the original download file. At the same time, you could put the exclude folder as well if you are using any cache plugin.

1. Download the Plugin.
2. Install it.
3. Go to the setting and make the changes or your need.