Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
quocle
Remote control Node
Commits
b0e20cc1
Commit
b0e20cc1
authored
5 years ago
by
Quoc Le
Browse files
Options
Download
Email Patches
Plain Diff
initial commit
parents
master
No related merge requests found
Pipeline
#6344
failed with stages
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
connectbp.sh
+90
-0
connectbp.sh
with
90 additions
and
0 deletions
+90
-0
connectbp.sh
0 → 100755
View file @
b0e20cc1
#!/bin/bash
// Host
USERNAME
=
ubuntu
HOSTIP
=(
18.139.184.146 3.18.22.25 13.234.138.137 52.78.55.141 13.235.211.142 13.209.36.3 13.250.28.184
)
HOSTNAME
=(
"SingaporeBP"
"OhioBP"
"MumbaiBP"
"SeoulBP"
"LondonBP"
"SaopauloBP"
"StateHistoryNode"
)
// Program Directory
NODEDIR
=
"/home/ubuntu/GenesisNode/genesis"
NODEOS_PATH
=
"PATH=
$PATH
:/home/ubuntu/eosio/1.8/bin"
COMMANDS
=(
"CHEK LOG"
"START"
"STOP"
"CLEAN"
"HARD START"
"EXIT"
)
HOSTNUM
=
${#
HOSTIP
[@]
}
// Commands
SCRIPT
=
"cd
$NODEDIR
; ls;"
SCRIPT_LOG
=
"cd
$NODEDIR
; tail -f blockchain/nodeos.log"
SCRIPT_GENESIS_START
=
"cd
$NODEDIR
; ./genesis_start.sh"
SCRIPT_START
=
"cd
$NODEDIR
;
${
NODEOS_PATH
}
; ./start.sh"
SCRIPT_HARD_START
=
"cd
$NODEDIR
;
${
NODEOS_PATH
}
; ./hard_start.sh"
SCRIPT_STOP
=
"cd
$NODEDIR
; ./stop.sh"
SCRIPT_CLEAN
=
"cd
$NODEDIR
; ./clean.sh"
// Setting
prompt_color
=
`
tput setaf 6
`
prompt_color_info
=
`
tput setaf 3
`
reset
=
`
tput sgr0
`
WORKINGDIR
=
"
$(
pwd
)
"
prompt_for_input
=
true
echo
"=============================================================="
echo
"= Please select the server ID: ="
echo
"=============================================================="
echo
" "
declare
-i
y
=
0
while
[
$y
-lt
${#
HOSTIP
[@]
}
]
do
echo
${
prompt_color_info
}
$y
". "
${
HOSTNAME
[
$y
]
}
" - "
${
HOSTIP
[
$y
]
}${
reset
}
y
=
`
expr
$y
+ 1
`
done
if
$prompt_for_input
;
then
read
-p
" >
${
prompt_color
}
Which is the Server ID you want to connect [0-
`
expr
$HOSTNUM
- 1
`
]?
${
reset
}
"
serverid
fi
if
[[
-n
${
serverid
//[0-9]/
}
||
(
$serverid
>
$HOSTNUM
)
]]
;
then
echo
"You need enter a valid server id [0-
`
expr
$HOSTNUM
- 1
`
]"
exit
fi
echo
"The selected server
${
HOSTNAME
[
$serverid
]
}
with IP
${
HOSTIP
[
$serverid
]
}
"
# ssh -l ${USERNAME} ${HOSTIP} "${SCRIPT}"
echo
"=============================================================="
echo
"= Please enter the command ID: ="
echo
"=============================================================="
echo
" "
while
[
true
]
do
echo
" "
declare
-i
z
=
0
while
[
$z
-lt
${#
COMMANDS
[@]
}
]
do
echo
${
prompt_color_info
}
$z
". "
${
COMMANDS
[
$z
]
}${
reset
}
z
=
`
expr
$z
+ 1
`
done
if
$prompt_for_input
;
then
read
-p
" >
${
prompt_color
}
Command ID [0-
`
expr
$z
- 1
`
]?
${
reset
}
"
commandid
fi
if
[[
-n
${
commandid
//[0-9]/
}
||
(
$commandid
>
$z
)
]]
;
then
echo
"You need enter a valid command id [0-
`
expr
$z
- 1
`
]"
else
case
${
commandid
}
in
0
)
ssh
-l
${
USERNAME
}
${
HOSTIP
}
"
${
SCRIPT_LOG
}
"
;;
1
)
ssh
-l
${
USERNAME
}
${
HOSTIP
}
"
${
SCRIPT_START
}
"
;;
2
)
ssh
-l
${
USERNAME
}
${
HOSTIP
}
"
${
SCRIPT_STOP
}
"
;;
3
)
ssh
-l
${
USERNAME
}
${
HOSTIP
}
"
${
SCRIPT_CLEAN
}
"
;;
4
)
ssh
-l
${
USERNAME
}
${
HOSTIP
}
"
${
SCRIPT_HARD_START
}
"
;;
5
)
exit
;;
esac
fi
done
This diff is collapsed.
Click to expand it.
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
Menu
Projects
Groups
Snippets
Help