The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
.
google unix.com



UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Unable to scp/sftp between two servers DeCoTwc UNIX for Dummies Questions & Answers 1 09-12-2008 03:11 PM
unable to schedule events through cron rakshit HP-UX 7 01-31-2008 04:57 AM
SFTP not exiting when run from cron msabhilash SUN Solaris 2 12-02-2007 07:48 PM
SFTP not working in cron ewilson0265 Shell Programming and Scripting 4 12-02-2007 11:29 AM
SFTP errorcode 1 when run on cron but runs manually Heidi.Ebbs SUN Solaris 2 08-08-2007 12:16 PM

 
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1 (permalink)  
Old 10-08-2008
Kronos Kronos is offline
Registered User
  
 

Join Date: Oct 2008
Location: Spain
Posts: 5
Unable to sftp with cron (once more time...)

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!!!
 

Bookmarks

Tags
cron, scp, script, sftp, shell script, shell scripting, unix scripting, unix scripting basics

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 01:10 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0