I'll take a stab at this answer. The OP did not say what OS is being used, so I will be somewhat generic.
First, make a file called free_os_cache.sh
#!/bin/sh # Description # Forces the OS to clear OS caches # Run a sync to reduce dirty caches sync # Tell the OS to not make warnings echo 4 | tee /proc/sys/vm/drop_caches # Tell the OS to clear caches echo 3 | tee /proc/sys/vm/drop_caches # Wait a tiny bit, just for safety (may not be necessary) sleep 5 # Reset to 0 echo 0 | tee /proc/sys/vm/drop_caches exit Then, allow it to be executed
chmod 744755 free_os_cache.sh
Next, add this to your sudoers file:
ALL = /path_to_file/free_os_cache.sh
Now, your users ought to be able to run this command:
sudo /path_to_file/free_os_cache.sh
That ought to get you close enough that you can tweak it for your particular environment.
$0.02