Yeah, I know it's classic. I've googled it all around, but still it doesn't work. I have the following script: #First go to SVN repo foldercd $svnrepos# Just make sure we have write access to backup-folderif [ -d $bakdest ] && [ -w $bakdest ] ; then  # Now $repo has folder names = project names  for repo in *; do    # do svn dump for each project    echo Taking backup/svndump for: $repo    echo Executing : svnadmin dump $repo > $bakdest/$repo-$bakdate.svn.dump \n    # Now finally execute the backup    svnadmin dump $repo > $bakdest/$repo-$bakdate.svn.dump    # You can go an extra mile by applying tar-gz compression to svn-dumps    # We also would like to save the dump to remote place/usb      # USB/other directory exists, copy the dump there      echo Going to copy $repo dump to $baktousb directory...\n      /usr/bin/scp -v $bakdest/$repo-$bakdate.svn.dump $baktousb/$repo-$bakdate.svn.dump  doneelse  echo Unable to continue SVN backup process.  echo $bakdest is *NOT* a directory or you do not have write permission.fi# End of backup scriptecho \n\n=================================echo  - Backup Complete, THANK YOU :-]everything works fine in shell, but when It's executed as cron job it simply doesn't scp (but does create a backup). Yes, I have an empty paraphrase. Can't get why it doesn't work.
Scp doesn't work in cron
ssh;cron;backup;scp
The issue is that you are probably running ssh-agent in your interactive environment but do not in cron and that your ssh key filename is different from the default filenames.To solve this you can either explicitly specify the ssh key in your scp commandline, i.e. scp -i $SSH_KEY_FILENAME or specify an appropriate ~/.ssh/config entry for your host, i.e:Host backuphost    IdentityFile SSH_KEY_FILENAMETo test your script you can try to run it via env -i /path/to/your/script which should reset your environment and mimic the cron environment.