Reputation: 1388
This works fine when I run it by hand:
#!/bin/bash
eval `ssh-agent`
ssh-add
/usr/bin/scp me@server:~/file ./
exit 0
However, when the cron runs the file is never touched. I know the ssh keys are right - replace that scp
with an ssh
and it runs fine.
Upvotes: 1
Views: 1822
Reputation: 5858
Not sure what version you are running, but in Snow Leopard cron jobs run as the user (check with whoami
in your cron'd script) ... at least when the user is currently logged in.
Upvotes: 0
Reputation: 7199
You also might consider using rsync for this process instead of scp'ing the file as a cron script.
Upvotes: 2
Reputation: 17131
cron generally is run as root, have you tested this script as root to ensure that the ssh keys are in the correct location that root looks for? Or do you have your sshkeys in your user profile?
Upvotes: 1