The UNIX and Linux Forums  

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

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 04-24-2007
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,
Reply With Quote
Forum Sponsor
  #2 (permalink)  
Old 04-24-2007
reborg's Avatar
Administrator
 
Join Date: Mar 2005
Location: Ireland
Posts: 3,473
See related posts in the frequently asked questions.
Reply With Quote
  #3 (permalink)  
Old 04-25-2007
Registered User
 

Join Date: Feb 2007
Posts: 31
I have read the instructions as you have said. but it's still not working.
Reply With Quote
  #4 (permalink)  
Old 01-10-2008
flatopokey's Avatar
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.
Reply With Quote
Google UNIX.COM
Reply

Thread Tools
Display Modes




All times are GMT -7. The time now is 01:48 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008 The CEP Blog All Rights Reserved -Ad Management by RedTyger Visit The Global Fact Book

Content Relevant URLs by vBSEO 3.2.0