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
cronjob wiz83 UNIX for Dummies Questions & Answers 1 01-25-2008 02:47 AM
cronjob not working manna UNIX for Advanced & Expert Users 8 01-17-2008 10:11 AM
SFTP not working in cron ewilson0265 Shell Programming and Scripting 4 12-02-2007 11:29 AM
CronJob hcng08 HP-UX 1 08-01-2006 10:44 PM
cannot run cronjob shahrahulb UNIX for Advanced & Expert Users 3 10-28-2004 09:45 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 04-24-2007
tungaw2004 tungaw2004 is offline
Registered User
  
 

Join Date: Feb 2007
Posts: 31
sftp not working as cronjob

hi,

I have a script that will automatically login into a server and get a file. it is working fine if i run it on a command line. however, when i tried to run it as a cron job, it is not working. what should i do?

set timeout -1
spawn /usr/bin/sftp user1@server1
match_max 100000
expect -exact "Connecting to server1...\r
user1@server1's password: "
send -- "passwordtxt\r"
expect -exact "\r
sftp> "
send -- "cd .ssh\r"
expect -exact "cd .ssh\r
sftp> "
send -- "get file1\r"
expect -exact "get file1\r
Fetching /users/user1/.ssh/file1 to file1\r
sftp> "
send -- "exit\r"
expect eof

NOTE: i do not want to use scp,ftp,cp or any other filetransfer because it needs some keys to be setup. all i want to do is run this as a cron job.

thanks,
  #2 (permalink)  
Old 04-24-2007
reborg's Avatar
reborg reborg is offline Forum Staff  
Administrator
  
 

Join Date: Mar 2005
Location: Ireland
Posts: 4,190
See related posts in the frequently asked questions.
  #3 (permalink)  
Old 04-25-2007
tungaw2004 tungaw2004 is offline
Registered User
  
 

Join Date: Feb 2007
Posts: 31
I have read the instructions as you have said. but it's still not working.
  #4 (permalink)  
Old 01-10-2008
flatopokey's Avatar
flatopokey flatopokey is offline
Registered User
  
 

Join Date: Jan 2008
Location: NY
Posts: 8
Not sure if you are still having issue but....
Remember that no environment variables will be passed to cron ..if the sftp script requires them then it will need to added to your script.
Sponsored Links
Closed Thread

Bookmarks

Tags
sftp script

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 07:15 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language translation by Google.
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