Update Reconnect Peers
This commit is contained in:
parent
1ae874e50b
commit
44b91e9897
141
ghost.sh
Normal file → Executable file
141
ghost.sh
Normal file → Executable file
@ -777,6 +777,9 @@ stop_service() {
|
|||||||
|
|
||||||
|
|
||||||
reconnect_peers() {
|
reconnect_peers() {
|
||||||
|
|
||||||
|
GHOST_NODE_DIR="/root/ghost/ghost-node"
|
||||||
|
|
||||||
# Step 1: Stop the running Ghost node service
|
# Step 1: Stop the running Ghost node service
|
||||||
echo "Stopping the Ghost node..."
|
echo "Stopping the Ghost node..."
|
||||||
sudo systemctl stop ghost-node
|
sudo systemctl stop ghost-node
|
||||||
@ -786,94 +789,108 @@ reconnect_peers() {
|
|||||||
sleep 1
|
sleep 1
|
||||||
|
|
||||||
# Step 2: Navigate to the Ghost node folder or exit if not found
|
# Step 2: Navigate to the Ghost node folder or exit if not found
|
||||||
echo "Navigating to the Ghost node folder..."
|
if [ -d "$GHOST_NODE_DIR" ]; then
|
||||||
cd ghost/ghost-node || { echo "Ghost node folder not found. Exiting."; exit 1; }
|
echo "Directory $GHOST_NODE_DIR exists."
|
||||||
|
cd "$GHOST_NODE_DIR"
|
||||||
|
|
||||||
# Inform the user and add a delay for better clarity
|
# Inform the user and add a delay for better clarity
|
||||||
print_info "Please wait ..."
|
print_info "Please wait ..."
|
||||||
sleep 1
|
sleep 1
|
||||||
|
|
||||||
# Step 3: Clean up old Ghost node data by removing the folder
|
# Step 3: Clean up old Ghost node data by removing the folder
|
||||||
echo "Cleaning up existing Ghost node data..."
|
echo "Cleaning up existing Ghost node data..."
|
||||||
sudo rm -rf /var/lib/ghost
|
sudo rm -rf /var/lib/ghost
|
||||||
|
|
||||||
# Inform the user and add a delay for better clarity
|
# Inform the user and add a delay for better clarity
|
||||||
print_info "Please wait ..."
|
print_info "Please wait ..."
|
||||||
sleep 1
|
sleep 1
|
||||||
|
|
||||||
# Step 4: Switch to the 'main' branch in the Git repository
|
# Step 4: Switch to the 'main' branch in the Git repository
|
||||||
echo "Switching to the 'main' branch..."
|
echo "Switching to the 'main' branch..."
|
||||||
git switch main
|
git switch main
|
||||||
|
|
||||||
# Step 5: Pull the latest updates from the Git repository
|
# Step 5: Pull the latest updates from the Git repository
|
||||||
echo "Pulling the latest updates from the repository..."
|
echo "Pulling the latest updates from the repository..."
|
||||||
git pull origin main
|
git pull origin main
|
||||||
|
|
||||||
# Inform the user and add a delay for better clarity
|
# Inform the user and add a delay for better clarity
|
||||||
print_info "Please wait ..."
|
print_info "Please wait ..."
|
||||||
sleep 1
|
sleep 1
|
||||||
|
|
||||||
# Step 6: Start the setup process with release and global options
|
# Rust Installation with rust_setup function
|
||||||
echo "Starting the setup process..."
|
print_info "ReChecking Rust..."
|
||||||
./scripts/starter.sh --release --make-global
|
rust_setup || { echo "Rust setup failed! Exiting."; exit 1; }
|
||||||
|
|
||||||
# Inform the user and add a delay for better clarity
|
# Inform the user and add a delay for better clarity
|
||||||
print_info "Please wait ..."
|
print_info "Please wait ..."
|
||||||
sleep 1
|
sleep 1
|
||||||
|
|
||||||
# Step 7: Verify the SHA256 checksum of the Casper JSON file
|
# Step 6: Start the setup process with release and global options
|
||||||
echo "Checking SHA256 checksum of the Casper JSON..."
|
echo "Starting the setup process..."
|
||||||
sha256sum /etc/ghost/casper.json
|
./scripts/starter.sh --release --make-global
|
||||||
|
|
||||||
# Inform the user and add a delay for better clarity
|
# Inform the user and add a delay for better clarity
|
||||||
print_info "Please wait ..."
|
print_info "Please wait ..."
|
||||||
sleep 1
|
sleep 1
|
||||||
|
|
||||||
# Step 8: Set the unit file arguments for the service
|
# Step 7: Verify the SHA256 checksum of the Casper JSON file
|
||||||
echo "Setting unit file arguments..."
|
echo "Checking SHA256 checksum of the Casper JSON..."
|
||||||
./scripts/starter.sh --unit-file --set-arguments
|
sha256sum /etc/ghost/casper.json
|
||||||
|
|
||||||
# Step 9: Perform a keys check
|
# Inform the user and add a delay for better clarity
|
||||||
echo "Checking keys..."
|
print_info "Please wait ..."
|
||||||
./scripts/starter.sh --check-keys
|
sleep 1
|
||||||
|
|
||||||
# Step 10: Start the Ghost node service
|
# Step 8: Set the unit file arguments for the service
|
||||||
echo "Starting the Ghost node..."
|
echo "Setting unit file arguments..."
|
||||||
sudo systemctl start ghost-node
|
./scripts/starter.sh --unit-file --set-arguments
|
||||||
|
|
||||||
# Add a delay to allow the service to stabilize
|
# Step 9: Perform a keys check
|
||||||
print_info "Please wait 1 minute ..."
|
echo "Checking keys..."
|
||||||
sleep 60
|
./scripts/starter.sh --check-keys
|
||||||
|
|
||||||
# Step 11: Insert keys into the node
|
# Step 10: Start the Ghost node service
|
||||||
echo "Inserting keys..."
|
echo "Starting the Ghost node..."
|
||||||
./scripts/starter.sh --check-keys --insert-keys
|
sudo systemctl start ghost-node
|
||||||
|
|
||||||
# Inform the user and add a delay for better clarity
|
# Add a delay to allow the service to stabilize
|
||||||
print_info "Please wait ..."
|
print_info "Please wait 1 minute ..."
|
||||||
sleep 1
|
sleep 60
|
||||||
|
|
||||||
# Step 12: Restart the Ghost node service
|
# Step 11: Insert keys into the node
|
||||||
echo "Restarting the Ghost node..."
|
echo "Inserting keys..."
|
||||||
sudo systemctl restart ghost-node
|
./scripts/starter.sh --check-keys --insert-keys
|
||||||
|
|
||||||
# Inform the user and add a delay for better clarity
|
# Inform the user and add a delay for better clarity
|
||||||
print_info "Please wait ..."
|
print_info "Please wait ..."
|
||||||
sleep 1
|
sleep 1
|
||||||
|
|
||||||
# Step 13: Enable the Ghost node service for auto-start on boot
|
# Step 12: Restart the Ghost node service
|
||||||
echo "Enabling the Ghost node service..."
|
echo "Restarting the Ghost node..."
|
||||||
sudo systemctl enable ghost-node
|
sudo systemctl restart ghost-node
|
||||||
|
|
||||||
# Final step: Notify the user of successful completion
|
# Inform the user and add a delay for better clarity
|
||||||
echo "Reconnect process completed successfully!"
|
print_info "Please wait ..."
|
||||||
|
sleep 1
|
||||||
|
|
||||||
|
# Step 13: Enable the Ghost node service for auto-start on boot
|
||||||
|
echo "Enabling the Ghost node service..."
|
||||||
|
sudo systemctl enable ghost-node
|
||||||
|
|
||||||
|
# Final step: Notify the user of successful completion
|
||||||
|
echo "Reconnect process completed successfully!"
|
||||||
|
|
||||||
|
else
|
||||||
|
echo "Error: Directory $GHOST_NODE_DIR does not exist."
|
||||||
|
echo "Please run the setup_node function first."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
# Call the Master function to display the menu
|
# Call the Master function to display the menu
|
||||||
master
|
master
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
enable_service() {
|
enable_service() {
|
||||||
echo "Enabling the ghost-node service to start at boot..."
|
echo "Enabling the ghost-node service to start at boot..."
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user