Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
chain33-pai
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
szh
chain33-pai
Commits
d6b2e766
Commit
d6b2e766
authored
Jun 03, 2020
by
szh
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add FindAbsPath func
parent
58fee7f2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
2 deletions
+18
-2
pai.go
pkg/pai/pai.go
+17
-0
pai.go
service/pai_service/pai.go
+1
-2
No files found.
pkg/pai/pai.go
View file @
d6b2e766
...
@@ -6,6 +6,7 @@ import (
...
@@ -6,6 +6,7 @@ import (
"strings"
"strings"
"chain33-pai/pkg/util"
"chain33-pai/pkg/util"
"github.com/33cn/chain33/common/log"
"github.com/33cn/chain33/common/log"
"bytes"
)
)
var
tlog
=
log
.
New
(
"pkg"
,
"pai"
)
var
tlog
=
log
.
New
(
"pkg"
,
"pai"
)
...
@@ -50,3 +51,18 @@ func MonitorServer() ([]*Disk,error) {
...
@@ -50,3 +51,18 @@ func MonitorServer() ([]*Disk,error) {
}
}
return
tempDisk
,
nil
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
service/pai_service/pai.go
View file @
d6b2e766
...
@@ -14,7 +14,6 @@ import (
...
@@ -14,7 +14,6 @@ import (
"encoding/json"
"encoding/json"
"chain33-pai/pkg/setting"
"chain33-pai/pkg/setting"
"chain33-pai/pkg/pai"
"chain33-pai/pkg/pai"
"chain33-pai/pkg/app"
"os"
"os"
"errors"
"errors"
)
)
...
@@ -218,7 +217,7 @@ func (p *Pai) GetDiskUseage() error {
...
@@ -218,7 +217,7 @@ func (p *Pai) GetDiskUseage() error {
}
}
func
(
p
*
Pai
)
CheckBackup
()
error
{
func
(
p
*
Pai
)
CheckBackup
()
error
{
path
:=
app
.
GetAbsPath
(
"v7-bityuan
"
)
path
:=
pai
.
FindAbsPath
(
"wallet-bty
"
)
if
path
==
""
{
if
path
==
""
{
tlog
.
Error
(
"IsBackup"
,
"path"
,
"node not exists"
)
tlog
.
Error
(
"IsBackup"
,
"path"
,
"node not exists"
)
//p.IsBackup = false
//p.IsBackup = false
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment