-
Notifications
You must be signed in to change notification settings - Fork 63
Restart the nodes using an automated script
This guide assumes that you have read and understood the readme.md, downloaded the official images or installed Skywire from source and do every step exactly the way it is described. Misconduct will lead to an inability to connect and to potential reflashing. It is very important that there is no IP collision with your existing home router subnet. The default settings of the official images, as well as the router of the Skyminer, are using the 192.168.0.0/24 subnet.
This guide will provide you with a script that restarts the secondary pi's + the manager all at once. All the steps are designed for usage with the official images but can be adjusted to work with any other startup scripts as well.
- official images/multiple pi's with static ip's
- SSH/Putty to access the manager pi or access to the manager's web interface
Login to your manager pi via SSH/using putty or open a terminal inside the manager's web interface.
Change to home directory via cd ~
.
Now we need to create the script that will take care of the changes we want to apply.
Execute nano restart.sh
to open an editor:
This is the content of the script that we are going to use. Copy and paste it into the editor you just opened.
#!/bin/bash
#This script schedules a reboot for the secondary pi's after 2 minutes
#It assumes that you previously changed the rebuild.sh scripts to start with a time delay that
#is individual to each node (10 seconds rest in between nodes is sufficient)
#username
USERNAME=root
#reboot the secondary pi
HOSTS="192.168.0.3 192.168.0.4 192.168.0.5 192.168.0.6 192.168.0.7 192.168.0.8 192.168.0.9"
for HOSTNAME in ${HOSTS} ; do
if ping -W5 -i0.5 -c 1 &> /dev/null
then
echo 1
echo "no connection to host" ${HOSTNAME}
else
echo "ping received from" ${HOSTNAME}
ssh ${USERNAME}@${HOSTNAME} "shutdown -r 2"
fi
done
#reboot the manager itself
echo "Rebooting the manager now"
reboot
Save the file via ctrl+x and yes.
After that make the script executable via chmod +x restart.sh
Execute the script via ./restart.sh
, you will be queried to enter the passwords for the root user one after another. The output should look like this:
All the secondary pi's will now reboot after 2 minutes, the manager will reboot immediately. This will result in temporary unresponsive nodes connected to the manager, you need to wait a total of 3.5 minutes (210 seconds) until all pi's should be up again and connected to the manager.
If you happen to encounter the error message Read from socket failed: connection reset by peer
then you need need to apply the steps describe here
Change the following line
HOSTS="192.168.0.3 192.168.0.4 192.168.0.5 192.168.0.6 192.168.0.7 192.168.0.8 192.168.0.9"
to
HOSTS="IP_NODE_1 IP_NODE_2 IP_NODE_3 IP_NODE_4 IP_NODE_5 IP_NODE_6 IP_NODE_7 IP_NODE_8 IP_NODE_9"
where you have to replace IP_NODE_1 IP_NODE_2
etc. with the IPs of your nodes.
Keep in mind that the IPs are starting with your first node and not with the IP of the manager!
Change the following line:
USERNAME = your_username
to the user you are using on the pi's. For raspberry pi that would be USERNAME=pi
IP range of 192.168.0.3-9
is assumed.
#!/bin/bash
#This script schedules a reboot for the secondary pi's after 2 minutes
#It assumes that you previously changed the rebuild.sh scripts to start with a time delay that
#is individual to each node (10 seconds rest in between nodes is sufficient)
#username
USERNAME=pi
#reboot the secondary pi
HOSTS="192.168.0.3 192.168.0.4 192.168.0.5 192.168.0.6 192.168.0.7 192.168.0.8 192.168.0.9"
for HOSTNAME in ${HOSTS} ; do
if ping -W5 -i0.5 -c 1 &> /dev/null
then
echo 1
echo "no connection to host" ${HOSTNAME}
else
echo "ping received from" ${HOSTNAME}
ssh ${USERNAME}@${HOSTNAME} "sudo shutdown -r 2"
fi
done
#reboot the manager itself
echo "Rebooting the manager now"
sudo reboot
The rest of the steps in the guide stay the same.
- Skywire Testnet Rules
- Skywire Authentication System User Guide
- Skywire Whitelisting System User Guide
- Official Skyminer Guide
- Testnet Discovery Address Change Instructions
- Skywire Installation Guide
- Skyflash User Guide
- Networking guide for the official router
- Official Skyminer - Wiring
- Public Key Backup
- Skywire Rasberry Pi Installation Guide
- Skywire Systemd Service
- Skywire Manager Web Interface
- Online Status Verification User Guide
- Skywire SSH User Guide
- Skywire SOCKS5 Proxy User Guide
- Single Board Computer WiFi Hotspot
- HTTP Proxy Service with Skywire VPN
- Setting Up Multiple Virtual Machines with Skywire VPN
- Tunnel exit node traffic through VPN
- Connecting Skynodes to your own OpenVPN Server
- Change startup delay of node processes using an automated script
- Change DNS of the official images
- Automated restart script
- Automated poweroff script
- Automated restart of node app
- Automated reboot if the network connections drops off