Skip to main content
edited tags
Link
Jeff Schaller
  • 68.8k
  • 35
  • 122
  • 264
Tweeted twitter.com/StackUnix/status/1186703953087684608
added 160 characters in body
Source Link
MechEng
  • 233
  • 3
  • 7

In order to clear caches, I usually invoke

# echo 3 | tee /proc/sys/vm/drop_caches

This requires root privileges. Why do I need to do this occasionally? Because it can have a huge impact on the runtime of some of my programs. My question is: how can I do this without superuser privileges, in particular these 2 circumstances:

  1. I/the user does not have root privileges. Can the system administrator do anything to allow normal users run the command above?

  2. The calls to drop caches are from within a shell script, and running the whole script with superuser privileges is not an option. For example because there are multiple instances of calling "mpirun" within this script, which really should not be run as root. And running everything within the script as root, although only a few lines actually need it, does not seem like good practice to me.

edit: forgot to mention: above command only works while being logged in as root. Otherwise the command would be echo 3 | sudo tee /proc/sys/vm/drop_caches

In order to clear caches, I usually invoke

# echo 3 | tee /proc/sys/vm/drop_caches

This requires root privileges. Why do I need to do this occasionally? Because it can have a huge impact on the runtime of some of my programs. My question is: how can I do this without superuser privileges, in particular these 2 circumstances:

  1. I/the user does not have root privileges. Can the system administrator do anything to allow normal users run the command above?

  2. The calls to drop caches are from within a shell script, and running the whole script with superuser privileges is not an option. For example because there are multiple instances of calling "mpirun" within this script, which really should not be run as root. And running everything within the script as root, although only a few lines actually need it, does not seem like good practice to me.

In order to clear caches, I usually invoke

# echo 3 | tee /proc/sys/vm/drop_caches

This requires root privileges. Why do I need to do this occasionally? Because it can have a huge impact on the runtime of some of my programs. My question is: how can I do this without superuser privileges, in particular these 2 circumstances:

  1. I/the user does not have root privileges. Can the system administrator do anything to allow normal users run the command above?

  2. The calls to drop caches are from within a shell script, and running the whole script with superuser privileges is not an option. For example because there are multiple instances of calling "mpirun" within this script, which really should not be run as root. And running everything within the script as root, although only a few lines actually need it, does not seem like good practice to me.

edit: forgot to mention: above command only works while being logged in as root. Otherwise the command would be echo 3 | sudo tee /proc/sys/vm/drop_caches

deleted 5 characters in body
Source Link
MechEng
  • 233
  • 3
  • 7

In order to clear caches, I usually invoke

# echo 3 | sudo tee /proc/sys/vm/drop_caches

This requires root privileges. Why do I need to do this occasionally? Because it can have a huge impact on the runtime of some of my programs. My question is: how can I do this without superuser privileges, in particular these 2 circumstances:

  1. I/the user does not have root privileges. Can the system administrator do anything to allow normal users run the command above?

  2. The calls to drop caches are from within a shell script, and running the whole script with superuser privileges is not an option. For example because there are multiple instances of calling "mpirun" within this script, which really should not be run as root. And running everything within the script as root, although only a few lines actually need it, does not seem like good practice to me.

In order to clear caches, I usually invoke

# echo 3 | sudo tee /proc/sys/vm/drop_caches

This requires root privileges. Why do I need to do this occasionally? Because it can have a huge impact on the runtime of some of my programs. My question is: how can I do this without superuser privileges, in particular these 2 circumstances:

  1. I/the user does not have root privileges. Can the system administrator do anything to allow normal users run the command above?

  2. The calls to drop caches are from within a shell script, and running the whole script with superuser privileges is not an option. For example because there are multiple instances of calling "mpirun" within this script, which really should not be run as root. And running everything within the script as root, although only a few lines actually need it, does not seem like good practice to me.

In order to clear caches, I usually invoke

# echo 3 | tee /proc/sys/vm/drop_caches

This requires root privileges. Why do I need to do this occasionally? Because it can have a huge impact on the runtime of some of my programs. My question is: how can I do this without superuser privileges, in particular these 2 circumstances:

  1. I/the user does not have root privileges. Can the system administrator do anything to allow normal users run the command above?

  2. The calls to drop caches are from within a shell script, and running the whole script with superuser privileges is not an option. For example because there are multiple instances of calling "mpirun" within this script, which really should not be run as root. And running everything within the script as root, although only a few lines actually need it, does not seem like good practice to me.

Source Link
MechEng
  • 233
  • 3
  • 7
Loading