Updated ghost.sh file with new changes
This commit is contained in:
parent
d0a20aa1ab
commit
d60d2edd9f
@ -180,10 +180,13 @@ The script provides an interactive menu with the following options:
|
||||
20. **Status-Checker**
|
||||
Checks the status of the Ghost node service.
|
||||
|
||||
21. **Logs-Checker**
|
||||
21. **Account-ID**
|
||||
The function sends a curl request to the local node and uses jq to extract the result field Account ID (Peer ID).
|
||||
|
||||
22. **Logs-Checker**
|
||||
Displays the latest logs to monitor the Ghost node's performance or troubleshoot issues.
|
||||
|
||||
22. **Exit**
|
||||
23. **Exit**
|
||||
Exits the script and ends the session.
|
||||
|
||||
|
||||
|
37
ghost.sh
37
ghost.sh
@ -945,6 +945,29 @@ restart_service() {
|
||||
}
|
||||
|
||||
|
||||
# Function to fetch and display the Peer ID (Account ID)
|
||||
account_id() {
|
||||
# Check if jq is installed
|
||||
if ! command -v jq &> /dev/null; then
|
||||
echo "'jq' is not installed. Installing jq now..."
|
||||
# Install jq if not present
|
||||
sudo apt update && sudo apt install -y jq
|
||||
echo "jq has been installed."
|
||||
else
|
||||
echo "jq is already installed. Proceeding with fetching the Peer ID..."
|
||||
fi
|
||||
|
||||
# Fetch the Peer ID using curl and jq
|
||||
peer_id=$(curl -s -H "Content-Type: application/json" -d '{"id":1, "jsonrpc":"2.0", "method": "system_localPeerId", "params":[]}' http://localhost:9945 | jq -r '.result')
|
||||
|
||||
# Return the Peer ID (Account ID)
|
||||
echo "Account ID: $peer_id"
|
||||
|
||||
# Call the Master function to display the menu
|
||||
master
|
||||
}
|
||||
|
||||
|
||||
logs_checker() {
|
||||
echo "Checking logs for the ghost-node service..."
|
||||
|
||||
@ -984,15 +1007,16 @@ master() {
|
||||
print_info "18. Reconnect-Peers"
|
||||
print_info "19. Restart-Service"
|
||||
print_info "20. Status-Checker"
|
||||
print_info "21. Logs-Checker"
|
||||
print_info "22. Exit"
|
||||
print_info "21. Account-ID"
|
||||
print_info "22. Logs-Checker"
|
||||
print_info "23. Exit"
|
||||
print_info ""
|
||||
print_info "==============================="
|
||||
print_info " Created By : CB-Master "
|
||||
print_info "==============================="
|
||||
print_info ""
|
||||
|
||||
read -p "Enter your choice (1 or 22): " user_choice
|
||||
read -p "Enter your choice (1 or 23): " user_choice
|
||||
|
||||
case $user_choice in
|
||||
1)
|
||||
@ -1056,13 +1080,16 @@ master() {
|
||||
status_service
|
||||
;;
|
||||
21)
|
||||
logs_checker
|
||||
account_id
|
||||
;;
|
||||
22)
|
||||
logs_checker
|
||||
;;
|
||||
23)
|
||||
exit 0 # Exit the script after breaking the loop
|
||||
;;
|
||||
*)
|
||||
print_error "Invalid choice. Please enter 1 or 22 : "
|
||||
print_error "Invalid choice. Please enter 1 or 23 : "
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user