Add HOST_VAR envvar and use to locate utmp on Linux.

parent f23a6bd2
......@@ -132,7 +132,7 @@ func Uptime() (uint64, error) {
}
func Users() ([]UserStat, error) {
utmpfile := "/var/run/utmp"
utmpfile := common.HostVar("run/utmp")
file, err := os.Open(utmpfile)
if err != nil {
......
......@@ -316,6 +316,10 @@ func HostEtc(combineWith ...string) string {
return GetEnv("HOST_ETC", "/etc", combineWith...)
}
func HostVar(combineWith ...string) string {
return GetEnv("HOST_VAR", "/var", combineWith...)
}
// https://gist.github.com/kylelemons/1525278
func Pipeline(cmds ...*exec.Cmd) ([]byte, []byte, error) {
// Require at least one command
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment