Hi,
I have been searching for older posts and I've found many entries with identical problems, but I was not able to find the solution (or when I thought I found it, my trial didn't worked
). Anyway, here is my question.
I wrote a sftp.sh file that runs perfect from command line. It uses scp for getting a file from a remote server. I use a key pair for the authentification, passphrase and ssh-agent included, as I learnt from the forum.
Then I added a task in the user crontab. The crontab works fine, as I added a trivial line in the sftp.sh script and it is executed as expected. But the scp line does not work.
The sftp.sh script scheme is:
#!/usr/bin/ksh
/usr/bin/scp
root@remote.server:/path/file1 file2
exit 0
In case I use sftp instead of scp:
#!/usr/bin/ksh
sftp -b /dev/stdin
root@remote.server <<EOF
get file
quit
EOF
exit 0
I found some comments on the environment of cron, but I was not able to solve the problem with those references...
I run it on Red Hat Enterprise 5. If I find any solution I'll post it, but I'm completely run out of ideas (only few weeks linux user, so I don't have many of them, in any case!)
Any help???? Thanks!!!