2019-12-02 09:57:14 -05:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"log"
|
|
|
|
"os/exec"
|
2019-12-11 08:50:49 -05:00
|
|
|
|
2020-12-12 12:55:35 -05:00
|
|
|
"github.com/shirou/gopsutil/disk"
|
2019-12-02 09:57:14 -05:00
|
|
|
)
|
|
|
|
|
|
|
|
func main() {
|
2019-12-11 08:50:49 -05:00
|
|
|
dparts, _ := disk.Partitions(false)
|
|
|
|
for _, part := range dparts {
|
|
|
|
u, _ := disk.Usage(part.Mountpoint)
|
2020-11-21 09:07:34 -05:00
|
|
|
if u != nil {
|
|
|
|
log.Printf("%s %d %d", part.Device, u.Total, u.Used)
|
|
|
|
}
|
2019-12-11 08:50:49 -05:00
|
|
|
}
|
2019-12-02 09:57:14 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
func cmdExec() {
|
|
|
|
cmd := exec.Command("ping", "qiongbi.net", "-c2")
|
|
|
|
output, err := cmd.Output()
|
|
|
|
log.Println("output:", string(output))
|
|
|
|
log.Println("err:", err)
|
|
|
|
|
|
|
|
cmd = exec.Command("ping", "qiongbi", "-c2")
|
|
|
|
output, err = cmd.Output()
|
|
|
|
log.Println("output:", string(output))
|
|
|
|
log.Println("err:", err)
|
|
|
|
}
|