Gyu-Ho Lee 2016-02-11 13:38:13 -08:00
parent fcf94f3a59
commit 78df258ea8
1 changed files with 12 additions and 1 deletions

View File

@ -16,6 +16,7 @@ package main
import (
"fmt"
"log"
"net"
"os"
"os/exec"
@ -119,7 +120,17 @@ func (a *Agent) cleanup() error {
}
f, err := os.Create(a.etcdLogPath)
a.logfile = f
return err
if err != nil {
return err
}
// https://www.kernel.org/doc/Documentation/sysctl/vm.txt
// https://github.com/torvalds/linux/blob/master/fs/drop_caches.c
cmd := exec.Command("/bin/sh", "-c", `echo "echo 1 > /proc/sys/vm/drop_caches" | sudo sh`)
if err := cmd.Run(); err != nil {
log.Printf("error when cleaning page cache (%v)", err)
}
return nil
}
// terminate stops the exiting etcd process the agent started