#!/bin/sh
# @file cpsudo_vm_drop_caches
# @brief script that clean cache/buffers
# @description Related to slab memory, if memory is too high, drop the slab caches.
#       see https://www.kernel.org/doc/Documentation/sysctl/vm.txt

/usr/sbin/sysctl -w vm.drop_caches=2 >/dev/null 2>&1

if [ $? ]; then
    date +"%F %T.%6N" >> "/var/tmp/catchpoint/drop_caches_timestamp"
    #printing a tuple for backward compatibilty
    echo "(True, '')"
else
    #printing a tuple for backward compatibilty
    echo "(False, 'Failed to drop the slab caches')"
fi