Skip to content

Commit

Permalink
2.5.1
Browse files Browse the repository at this point in the history
  • Loading branch information
geopsllc committed Aug 9, 2019
1 parent fe1dfcd commit d22f12d
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 4 deletions.
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ cd core-control
| `remove` | `core`/`self` | Remove Core / Core-Control |
| `secret` | `set`/`clear` | Delegate Secret Set / Clear |
| `start` | `relay`/`forger`/`all` | Start Core Services |
| `restart` | `relay`/`forger`/`all` | Restart Core Services |
| `restart` | `relay`/`forger`/`all`/`safe` | Restart Core Services |
| `stop` | `relay`/`forger`/`all` | Stop Core Services |
| `status` | `relay`/`forger`/`all` | Show Core Services Status |
| `logs` | `relay`/`forger`/`all` | Show Core Logs |
Expand All @@ -34,6 +34,8 @@ This is a Streamlined CLI-Based Core v2 Management Tool.
- For update you can skip the 'check' argument as it's the default.
- For system you can skip the 'info' argument as it's the default.
- For plugin you can skip the 'list' argument as it's the default.
- Using the 'restart safe' arguments requires the round-monitor core plugin and restarts the core services when safe to do so in
order to avoid missing a block.
- When setting a delegate secret just type your secret after the 'set' argument without quotes.
- When doing a rollback just type the desired height after the 'rollback' argument.
- Rollback will stop the running processes, do the rollback and start the processes that were online.
Expand All @@ -50,6 +52,7 @@ The end result is that your node will start syncing from 0.
## Changelog

### 2.5.1
- added restart safe option
- added plugin manager
- snapshot now uses the core-snapshot interface

Expand Down
5 changes: 4 additions & 1 deletion cccomp.bash
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,12 @@ ccontrol_completions () {
"secret")
COMPREPLY=( $(compgen -W "set clear" -- $cur) )
;;
"start"|"restart"|"stop"|"status"|"logs")
"start"|"stop"|"status"|"logs")
COMPREPLY=( $(compgen -W "relay forger all" -- $cur) )
;;
"restart")
COMPREPLY=( $(compgen -W "relay forger all safe" -- $cur) )
;;
"snapshot")
COMPREPLY=( $(compgen -W "create restore" -- $cur) )
;;
Expand Down
2 changes: 1 addition & 1 deletion ccontrol.sh
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ main () {

echo -e "\n${green}All Done!${nc}\n"

elif [[ ( "$1" = "restart" ) && ( "$2" = "relay" || "$2" = "forger" || "$2" = "all" || -z "$2" ) && ( -z "$3" ) ]]; then
elif [[ ( "$1" = "restart" ) && ( "$2" = "relay" || "$2" = "forger" || "$2" = "all" || "$2" = "safe" || -z "$2" ) && ( -z "$3" ) ]]; then

if [[ ! -d $data || ! -d $core ]]; then
echo -e "\n${red}Core not installed. Please install first.${nc}\n"
Expand Down
19 changes: 18 additions & 1 deletion functions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ wrong_arguments () {
echo -e "| remove | core / self | Remove Core / Core-Control |"
echo -e "| secret | set / clear | Delegate Secret Set / Clear |"
echo -e "| start | relay / forger / all | Start Core Services |"
echo -e "| restart | relay / forger / all | Restart Core Services |"
echo -e "| restart | relay / forger / all / safe | Restart Core Services |"
echo -e "| stop | relay / forger / all | Stop Core Services |"
echo -e "| status | relay / forger / all | Show Core Services Status |"
echo -e "| logs | relay / forger / all | Show Core Logs |"
Expand Down Expand Up @@ -148,6 +148,23 @@ restart () {
echo -e "\n${red}Process forger not running. Skipping...${nc}"
fi

elif [ "$1" = "safe" ]; then

local api=$(curl -Is http://127.0.0.1:5001)
local fstatus=$(pm2status "${name}-forger" | awk '{print $13}')
local rstatus=$(pm2status "${name}-relay" | awk '{print $13}')

if [[ "$rstatus" != "online" || "$fstatus" != "online" ]]; then
echo -e "\n${red}Core processes not online!${nc}\n"
exit 1
elif [ -z "$api" ]; then
echo -e "\n${red}Plugin round-monitor not active!${nc}\n"
exit 1
else
curl -X POST http://127.0.0.1:5001/restart > /dev/null 2>&1
echo -e "\n${green}Restart requested. Check logs to monitor progress.${nc}"
fi

else

local pstatus=$(pm2status "${name}-$1" | awk '{print $13}')
Expand Down

0 comments on commit d22f12d

Please sign in to comment.