I have made a script that every 5 minutes downloads a still shot of the weather radar in my area and saves it into a folder on my server. This is done using a bash script and crontab.
On my computer, I've made a bash script to sync them, but it requires me to enter my password all the time for rsync.
I found a solution to that called sshpass.
First, we need to install it:
apt install sshpass
Now, we can use it. In my case, I'm using a bash script and a cron job to sync them every hour. Here's what my bash script looks like, using sshpass:
echo "Setting up.." export SSHPASS=supersecretpassword echo "Syncing..." sshpass -e rsync -Aax --progress [email protected]:/remotefolder /localfolder echo "Cleaning up.." echo "Done!"
The main thing is that you set the password variable, and keep the -e tag in sshpass (tells it to use an environment variable)
Hopefully that helps someone!