Automation#
Instructions to create automatic data uploads from your plant to SunPeek.
The following assumes:
You are running as a non root user which has read write access to the directory where the plant data is stored and sudo permissions
The machine you are running on has outbound internet access
You start the instructions in a shell in the user’s home directory
Run
ls -aand see if.sshappears in the output. If not runmkdir .sshcd .sshRun
ssh-keygen -t ed25519 -f sunpeek-upload-key. Then press enter twice to save the key without a password. This will create a public-private keypair. Public key will be saved as sunpeek-upload-key.pub, the private key as sunpeek-upload-key and this must be kept confidential.Restrict permissions on the private key:
chmod 600 sunpeek-upload-keyType
cat sunpeek-upload-key.pubto get the public key, and send it in an email. DO NOT send us sunpeek-upload-key, the private key!
Wait for us to confirm that the server is configured with your public key before continuing.
Note
Text between < > in steps 6 and 8 should be replaced by your own values.
Run
cd <plant data directory>.Test the data transfer. Run
rsync -rtPzv -e "ssh -i ~/.ssh/sunpeek-upload-key" ./ your_plant@data-upload.sunpeek.org:./. This command sends any files which are new or changed to the SunPeek data upload server. You should see a list of transferred files.Configure a cronjob to run the transfer daily: Run
crontab -eand enter this to configure crontab to run the transfer every hour:0 * * * * rsync -rtPz -e "ssh -i ~/.ssh/sunpeek-upload-key" <plant data directory> your_plant@data-upload.sunpeek.org:./ > /tmp/sunpeek_cronjob_log.txt 2>&1. Close the file, saving changes to the proposed filename.