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
f692d5aa
Commit
f692d5aa
authored
Jul 24, 2020
by
szh
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
up
parent
629a4038
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
18 additions
and
18 deletions
+18
-18
process.go
pkg/app/process.go
+14
-14
cmd.go
pkg/cmd/cmd.go
+1
-1
file.go
pkg/file/file.go
+2
-2
pai.go
service/pai_service/pai.go
+1
-1
No files found.
pkg/app/process.go
View file @
f692d5aa
...
...
@@ -42,7 +42,7 @@ type updateInfo struct {
type
Server
struct
{
Disks
[]
*
pai
.
Disk
`json:"disks"`
//硬盘信息
NodeProcess
sInfo
ProcessInfo
`json:"node_proces
ss_info"`
//节点信息
NodeProcess
Info
ProcessInfo
`json:"node_proce
ss_info"`
//节点信息
Error
string
`json:"error"`
//错误信息
}
...
...
@@ -101,14 +101,14 @@ func getWalletInfo() error {
if
buffer
.
String
()
==
""
{
tlog
.
Info
(
"node dose not exist"
)
return
fmt
.
Errorf
(
"node dose not exist"
)
}
else
{
fmt
.
Println
(
buffer
.
String
())
rawProcessInfo
=
getProcessInfo
(
setting
.
BityuanSetting
.
Name
)
if
rawProcessInfo
==
""
{
tlog
.
Info
(
"node down"
)
return
errors
.
New
(
"node down"
)
}
}
fmt
.
Println
(
buffer
.
String
())
rawProcessInfo
=
getProcessInfo
(
setting
.
BityuanSetting
.
Name
)
if
rawProcessInfo
==
""
{
tlog
.
Info
(
"node down"
)
return
errors
.
New
(
"node down"
)
}
}
record
:=
StrFilter
(
strings
.
Split
(
rawProcessInfo
,
" "
),
""
)
...
...
@@ -117,7 +117,7 @@ func getWalletInfo() error {
Bityuan
.
Pid
=
record
[
1
]
Bityuan
.
Path
=
record
[
10
]
Bityuan
.
PName
=
path
.
Base
(
Bityuan
.
Path
)
ServerStatus
.
NodeProcess
s
Info
=
Bityuan
ServerStatus
.
NodeProcessInfo
=
Bityuan
}
return
nil
}
...
...
@@ -384,7 +384,7 @@ func Unlock() error {
}
pass
:=
strings
.
Replace
(
string
(
passwd
),
"
\n
"
,
""
,
-
1
)
reply
,
err
:=
setting
.
PaiClient
.
Unlock
(
&
types
.
WalletUnLock
{
Passwd
:
string
(
pass
)
,
Passwd
:
pass
,
Timeout
:
0
,
WalletOrTicket
:
false
,
XXX_NoUnkeyedLiteral
:
struct
{}{},
...
...
@@ -470,17 +470,17 @@ func AutoSSHClean() error {
tlog
.
Info
(
"getAutoSSHProcessInfo"
,
"pai"
,
*
pai
)
if
pai
.
Stime
>
0
&&
(
time
.
Now
()
.
Unix
()
-
pai
.
Stime
)
>
72
*
3600
&&
pai
.
Pid
>
0
{
err
:=
KillAutoS
sh
(
pai
.
Pid
)
err
:=
KillAutoS
SH
(
pai
.
Pid
)
if
err
!=
nil
{
tlog
.
Error
(
"KillAutoS
sh
"
,
"err"
,
err
)
tlog
.
Error
(
"KillAutoS
SH
"
,
"err"
,
err
)
return
err
}
tlog
.
Info
(
"KillAutoS
sh
Success"
,
"pid"
,
pai
.
Pid
)
tlog
.
Info
(
"KillAutoS
SH
Success"
,
"pid"
,
pai
.
Pid
)
}
return
nil
}
func
KillAutoS
sh
(
pid
int32
)
error
{
func
KillAutoS
SH
(
pid
int32
)
error
{
ps
:=
fmt
.
Sprintf
(
"%d"
,
pid
)
cmd
:=
exec
.
Command
(
"kill"
,
ps
)
return
cmd
.
Run
()
...
...
pkg/cmd/cmd.go
View file @
f692d5aa
...
...
@@ -28,7 +28,7 @@ func GetLocalArchType() string {
return
""
}
func
GetLocalU
uid
()
string
{
func
GetLocalU
UID
()
string
{
cmd
:=
exec
.
Command
(
"dmidecode"
)
var
buf
,
errbuf
bytes
.
Buffer
cmd
.
Stdout
=
&
buf
...
...
pkg/file/file.go
View file @
f692d5aa
...
...
@@ -36,7 +36,7 @@ func CheckPermission(src string) bool {
// IsNotExistMkDir create a directory if it does not exist
func
IsNotExistMkDir
(
src
string
)
error
{
if
notExist
:=
CheckNotExist
(
src
);
notExist
==
true
{
if
notExist
:=
CheckNotExist
(
src
);
notExist
{
if
err
:=
MkDir
(
src
);
err
!=
nil
{
return
err
}
...
...
@@ -74,7 +74,7 @@ func MustOpen(fileName, filePath string) (*os.File, error) {
src
:=
dir
+
"/"
+
filePath
perm
:=
CheckPermission
(
src
)
if
perm
==
true
{
if
perm
{
return
nil
,
fmt
.
Errorf
(
"file.CheckPermission Permission denied src: %s"
,
src
)
}
...
...
service/pai_service/pai.go
View file @
f692d5aa
...
...
@@ -105,7 +105,7 @@ func (p *Pai) GetConfig() bool {
return
true
}
}
else
if
pai
.
GetArchType
()
==
"x86_64"
{
uuid
:=
cmd
.
GetLocalU
uid
()
uuid
:=
cmd
.
GetLocalU
UID
()
if
uuid
!=
""
{
p
.
Serial
=
uuid
return
true
...
...
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