Commit d6b2e766 authored by szh's avatar szh

add FindAbsPath func

parent 58fee7f2
......@@ -6,6 +6,7 @@ import (
"strings"
"chain33-pai/pkg/util"
"github.com/33cn/chain33/common/log"
"bytes"
)
var tlog = log.New("pkg","pai")
......@@ -50,3 +51,18 @@ func MonitorServer() ([]*Disk,error) {
}
return tempDisk,nil
}
func FindAbsPath(name string) string {
var buffer bytes.Buffer
cmd:=exec.Command("find","/media","-name",name)
cmd.Stdout=&buffer
cmd.Start()
cmd.Wait()
if buffer.String() == "" {
tlog.Error("FindAbsPath","ERR","node path not exists")
return ""
}
pathlist := strings.Split(buffer.String(),"\n")
return pathlist[0]
}
\ No newline at end of file
......@@ -14,7 +14,6 @@ import (
"encoding/json"
"chain33-pai/pkg/setting"
"chain33-pai/pkg/pai"
"chain33-pai/pkg/app"
"os"
"errors"
)
......@@ -218,7 +217,7 @@ func (p *Pai) GetDiskUseage() error {
}
func (p *Pai) CheckBackup() error {
path := app.GetAbsPath("v7-bityuan")
path := pai.FindAbsPath("wallet-bty")
if path == "" {
tlog.Error("IsBackup","path","node not exists")
//p.IsBackup = false
......
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