-
Notifications
You must be signed in to change notification settings - Fork 2
Slave
This description assumes, that you have followed this description about how to set up a Pi, and your device automatically loads the GUI.
sudo apt-get update
sudo apt-get install chromium
Create the directory and move to there
mkdir -p ~/dashboard-controller/bin
cd ~/dashboard-controller/bin
Get the binary from the master
curl [master IP/domain]:[master port - 5000 by default]/get_slave_binary -X GET > slave
eg:
curl 10.0.1.214:5000/get_slave_binary -X GET > slave
chmod +x slave
This step is optional but this way it’s easier to continue
export PATH=$PATH:$HOME/dashboard-controller/bin
(Note this is a temporary setting, by closing the terminal window your setting will be lost. If you want to make it permanent, put it in the end of the “~/.profile” file)
You can run the executable with a specified slave name and master IP address.
slave [flag arguments]
- -slaveName
With this flag you can set the desired name for the slave. If you don't add this flag, the default slave name is "SLAVE NAME UNSPECIFIED". If you want to use spaces, don't forget to put the name between quotes.
- -port
With this flag you can set the slave output port. Normally you don't need to change this. The default value is 8080.
- -masterIP
With this flag, specify the IP address of master. The default value is localhost.
- -masterPort
With this flag, specify the port number of master. The default port number is 5000.
Example usage:
slave -slaveName="Main Lobby" -port=9999 -masterIP=10.0.0.195 -masterPort=9090
The slave will automatically map itself to the master and periodically emit heartbeats to the master. If the slave's heartbeats do not reach the master for some period of the time, the master will mark the slave as dead and remove it from the map of available slaves.
In this part it gets a little bit trickier. If you want to see the logs in a file, you have to redirect it.
You need to create a desktop entry:
sudo nano /etc/xdg/autostart/dashboard.desktop
With the following content:
[Desktop Entry]
Name=Dashboard Controll Autostart
Exec=slave [flags] [redirect the log]
Type=Application
Terminal=false
For example:
[Desktop Entry]
Name=Dashboard Controll Autostart
Exec=slave -slaveName='leftPi' -masterIP=10.0.0.60 -masterPort=5000 &> ~/dashboard-log.txt &
Type=Application
Terminal=false
This script will start a slave on startup with slavename "left Pi", and will connect to the master with the specified data. This script redirects its errors and outputs to the dashboard-log.txt file in the home directory. It might be useful in case of failure. The redirection is optional.
Copyright © 2014 Prezi Inc. | Contact