Sending the Sensor Outputs to a Server

Install FTP Remote Access

FTP (File Transfer Protocol) is needed to copy the temperature sensor information to a web server.  

The variant of FTP to be used is LFTP.  To install this on the Pi enter the following command:

pi@rapbeepi ~ $ sudo apt-get install lftp

We will use the FTP client to upload the graphs to a server.

Create an upload script to run to upload all the files to the web server.

pi@rapbeepi ~ $ sudo nano upload.sh

Copy the script below into the newly created file.

#!/bin/bashsleep 30lftp -u FTP_USERID,PASSWORD ftp.raspbeepi.uk <<EOFput RBP_temp_log_h.pngput RBP_temp_log_d.pngput RBP_temp_log_w.pngput RBP_temp_log_m.pngput RBP_temp_log_y.png#put RBP_humidity_log_h.png#put RBP_humidity_log_d.png#put RBP_humidity_log_w.png#put RBP_humidity_log_m.png#put RBP_humidity_log_y.pngquit 0EOF

Now make the file executable.

pi@rapbeepi ~ $ sudo chmod +x upload.sh

To add a scheduled job to upload the graphs regularly we need to set-up another cron job.  Start crontab by running the following command:

pi@RaspBeePi:/RaspBeePi_Monitor $ sudo crontab -e

Now add the following line to the file, save and close the file:

# m h dom mon dow command*/5 * * * * /RaspBeePi_Monitor/upload.sh >> /RaspBeePi_Monitor/RaspBeePi_cron.log 2>&1

This command runs the upload.sh script every five minutes. "&> /dev/null" takes the output from this command and discards it.