Scheduled scp on mac using launchd

Jessica writes:

I am trying to set up a scheduled data download from my shakes using launchd (on mac), but I am coming across permission issues due to the shake being password protected. I have tried to set up ssh-keygen and put my key onto the shake for unattended scp, but it is not working.

Do you have any tips?

My advice would be to try and use sshpass as suggested in this stackoverflow answer:

Specifically, I would point the launchd configuration file at a script containing one or more scp commands similar to the following:

sta='R3A9E'; cha='EHZ'; sshpass -p 'shakeme' scp -r myshake@rs.local:/opt/data/archive/$(date +%Y)/AM/$sta/$cha.D/AM.$sta.00.$cha.D.$(date +%Y).$(date +%j) /some/local/path

To install sshpass using macports:

sudo port install sshpass

Using Homebrew:

brew install https://raw.githubusercontent.com/kadwanev/bigboybrew/master/Library/Formula/sshpass.rb