Last change
on this file since 24693 was 24693, checked in by jmt12, 13 years ago |
A hack to allow sudoedit to modify the drop_caches value non-interactively
|
-
Property svn:executable
set to
*
|
File size:
834 bytes
|
Line | |
---|
1 | #!/bin/sh
|
---|
2 | # A swift hack. Sudoedit will call whatever your default editor is, passing
|
---|
3 | # in the name of the tmp file that it has copied to the system file to (and
|
---|
4 | # thus created a file that you have write permissions for). Once the 'editor'
|
---|
5 | # finishes, sudo copies the tmp file over the top of the system file and
|
---|
6 | # restores priviledges. Instead of opening an editor, we can simply clobber
|
---|
7 | # the contents of the file with "3" to reset the memory based disk cache. The
|
---|
8 | # only other magic needed is to override the default editor to point at this
|
---|
9 | # script just before calling the sudoedit command - and thus we can have a non-
|
---|
10 | # interactive way to drop memcache.
|
---|
11 | #
|
---|
12 | # @author John Thompson [jmt12]
|
---|
13 | # @author Zach Cutlip [http://shadow-file.blogspot.com/2009/01/how-to-sudoedit-non-interactively.html]
|
---|
14 | ECHO=/bin/echo
|
---|
15 | $ECHO 3 > "$1";
|
---|
16 | exit; |
---|
Note:
See
TracBrowser
for help on using the repository browser.