I have a script called clearcache.sh to clear my buffers / cache but when I run it keeps saying Permission denied.
Whats in the script: clearcache.sh
#!/bin/bash
sync && echo 1 | tee /proc/sys/vm/drop_caches
Rights:
-rwxr-xr-x 1 rt rt 464 Dec 5 02:10 clearcache.sh
How I run it to test it:
rt@sys76:~/clearcache$ ./clearcache.sh
tee: /proc/sys/vm/drop_caches: Permission denied
1
I want to place this in a chron job but I need to get past this permission issue:
Update: Here's the drop_caches file and it's rights owned by root what's the correct way to run this from a chron job using a script? PS: I'm running Ubuntu 20.04
/proc/sys/vm/drop_caches
? A regular user is probably not allowed to write to that file./proc/sys/vm/drop_caches
. I add the image to the question. Is there a way to work around this?