#!/bin/bash #.Y / 70 83 / / / / 105 / / / / / / ;A4_QUER.Y #.YT 3 2 0 0 3 3 1 / / / #.H!a!0:linux//memory/THIS!0.!c # # copyright : (C) 2009 by Thomas Bruecker =: tbrue # email : public0x05bf@bluewin.ch # # tbrue 30sep2011 # # memory THIS : memory-functions #+++++++++++++++++++++++++++++++ # # MyHash("linux//memory/THIS") = ^0x0XXX # # * for every function: # * if returned result is not commented, the function returns 0 on no-error. # # temp: SCRIPTS=root/bin memory_FreeCache() # * $1 in { "All", "Metadata", "Page" } : # * "All" : free page-, dentry- and inode-caches, # * "Metadata": free dentry- and inode-caches, # * "Page" : free pagecache; # * returns # 0 if ok, # 1 if wrong parameter for $1 . { local CmdParameter0x0XXX # see "/Documentation/sysctl/vm.txt::drop_caches". case "$1" in All) CmdParameter0x0XXX=3 ;; Metadata) CmdParameter0x0XXX=2 ;; Page) CmdParameter0x0XXX=1 ;; *) echo "Usage: \"MEMORY_ FreeCache All | Metadata | Page\"." return 1 esac sync # see "/Documentation/sysctl/vm.txt::drop_caches". echo "$CmdParameter0x0XXX" > "/proc/sys/vm/drop_caches" return 0 }