Thread Rating:
  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Auto Connect nodes at Boot
#1
Hi Guys i have just worked out how to get the nodes to auto connect on reboot / startup. 

I am a linux noob and have only just learnt how to use it for this project!


This is what i have discovered. 

Master / Node 1 

IP.ADD.HERE = your ip address looks like ( 192.162.100.40 )

Step 1. 

cd ~ 
vi master.sh

In the text editor enter. 

Code:
#!/bin/sh

export GOPATH="$HOME/go"



cd $GOPATH/bin
nohup ./manager -web-dir ${GOPATH}/src/github.com/skycoin/skywire/static/skywire-manager > /dev/null 2>&1 & echo $! > manager.pid

sleep 30

nohup ./node -connect-manager -manager-address IP.ADD.RES:5998 -manager-web IP.ADD.HERE:8000 > /dev/null 2>&1 & echo $! > node.pid

Step 2. chmod +x master.sh


Step 3. crontab -e 
Scroll to the bottom of the page and enter

Code:
@reboot /root/master.sh

Step 4. reboot 



Nodes 2/3/4/5/6/7/8

Step 1. 

cd ~ 
vi startnode.sh

In the text editor enter. 
Code:
#!/bin/sh

export GOPATH="$HOME/go"


cd $GOPATH/bin/
sleep 30

nohup ./node -connect-manager -manager-address IP.ADD.HERE:5998 -manager-web IP.ADD.HERE:8000 > /dev/null 2>&1 & echo $! > node.pid

Step 2. chmod +x startnode.sh


Step 3. crontab -e 
Scroll to the bottom of the page and enter. 

Code:
@reboot /root/startnode.sh

Step 4. reboot 

Repeat for all your other boards. 

Check your manager at 192.xxx.xxx.xxx:8000

Now on boot / reboot your nodes should connect after 30 seconds
[-] The following 5 users say Thank You to SkyVinnie for this post:
  • edoardocoen, Footballelixir, jaggedsoft, natminer, skyguy
1
1
Reply
#2
worked perfect thank you!
Reply
#3
Hi, Would this be exactly the same for my Raspberry Pi set-up running Raspbian Stretch Lite please?
Reply
#4
(04-30-2018, 06:50 PM)bulva Wrote: Hi, Would this be exactly the same for my Raspberry Pi set-up running Raspbian Stretch Lite please?

Yes exactly the same.
Reply
#5
(04-30-2018, 07:03 PM)natminer Wrote:
(04-30-2018, 06:50 PM)bulva Wrote: Hi, Would this be exactly the same for my Raspberry Pi set-up running Raspbian Stretch Lite please?

Yes exactly the same.

Thanks! ...but when I am in the text editor the keyboard suddenly goes funny and I can't enter anything..it either doesn't react or types different things. Any idea anyone please?
Reply
#6
(04-30-2018, 07:48 PM)bulva Wrote:
(04-30-2018, 07:03 PM)natminer Wrote:
(04-30-2018, 06:50 PM)bulva Wrote: Hi, Would this be exactly the same for my Raspberry Pi set-up running Raspbian Stretch Lite please?

Yes exactly the same.

Thanks! ...but when I am in the text editor the keyboard suddenly goes funny and I can't enter anything..it either doesn't react or types different things. Any idea anyone please?
Is it that you are in vi editor and not sure how to use it (like maybe you're just used to nano?), you can change the default editor by typing:
sudo select-editor
Reply
#7
hey how can i delete this script again? My manager is connecting to the old messenger adress everytime and i cannot fix it
Reply
#8
(05-22-2018, 06:30 PM)volle29 Wrote: hey how can i delete this script again? My manager is connecting to the old messenger adress everytime and i cannot fix it

Code:
sudo rm master.sh
sudo rm startnode.sh
Reply
#9
(04-12-2018, 07:29 AM)SkyVinnie Wrote: Hi Guys i have just worked out how to get the nodes to auto connect on reboot / startup. 

I am a linux noob and have only just learnt how to use it for this project!


This is what i have discovered. 

Master / Node 1 

IP.ADD.HERE = your ip address looks like ( 192.162.100.40 )

Step 1. 

cd ~ 
vi master.sh

In the text editor enter. 

Code:
#!/bin/sh

export GOPATH="$HOME/go"



cd $GOPATH/bin
nohup ./manager -web-dir ${GOPATH}/src/github.com/skycoin/skywire/static/skywire-manager > /dev/null 2>&1 & echo $! > manager.pid

sleep 30

nohup ./node -connect-manager -manager-address IP.ADD.RES:5998 -manager-web IP.ADD.HERE:8000 > /dev/null 2>&1 & echo $! > node.pid

Step 2. chmod +x master.sh


Step 3. crontab -e 
Scroll to the bottom of the page and enter

Code:
@reboot /root/master.sh

Step 4. reboot 



Nodes 2/3/4/5/6/7/8

Step 1. 

cd ~ 
vi startnode.sh

In the text editor enter. 
Code:
#!/bin/sh

export GOPATH="$HOME/go"


cd $GOPATH/bin/
sleep 30

nohup ./node -connect-manager -manager-address IP.ADD.HERE:5998 -manager-web IP.ADD.HERE:8000 > /dev/null 2>&1 & echo $! > node.pid

Step 2. chmod +x startnode.sh


Step 3. crontab -e 
Scroll to the bottom of the page and enter. 

Code:
@reboot /root/startnode.sh

Step 4. reboot 

Repeat for all your other boards. 

Check your manager at 192.xxx.xxx.xxx:8000

Now on boot / reboot your nodes should connect after 30 seconds
I have a strange problem where my non-manager nodes disappear every 2 hours. Could I add a timer to the crontab -e part to reboot my non manager nodes every couple of hours? Thanks!
Reply
#10
Did you ssh into the nodes before you entered the code?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)