LinuxQuestions.org
View the Most Wanted LQ Wiki articles.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices



Reply
 
Search this Thread
Old 04-21-2006, 05:09 PM   #1
giteshtrivedi
LQ Newbie
 
Registered: Apr 2006
Posts: 3

Rep: Reputation: 0
Automatic ftp using cron problem


Hello friends,

I got problem using cron. I have created a shell script which is
automatically ftp my files to remote server.But when manually I
executed same shell script it works fine.When I configure same script
in cron it is not working and gave me errors.

My Shell script is as follows...
ftp -i -n 192.168.10.4 <<EOF
user oracle Shekjg34
cd /u05/oralog/starship
bin
mput *.ARC
bye
EOF
exit 0

I also changed coding of above script as follows...

RHOST1=SolidOra12
USER1="oracle"
PASSWD1="Shekjg34"

ftp -n -i $RHOST1 <<EOF >>/oracle/admin/starship/adhoc/new_ftp/ftp_d.txt
user "$USER1" "$PASSWD1"
cd /u05/oralog/starship
bin
mput *.ARC
bye
EOF
exit 0

But each time it gave me following errors..

Login incorrect.
Login failed.
Please login with USER and PASS.
Please login with USER and PASS.

Please let me guide to resolve this issue.
Thanks in Advance.

Regards,
Gitesh
 
Old 04-21-2006, 05:23 PM   #2
bathory
Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 10,975

Rep: Reputation: 1343Reputation: 1343Reputation: 1343Reputation: 1343Reputation: 1343Reputation: 1343Reputation: 1343Reputation: 1343Reputation: 1343Reputation: 1343
You can try ftp://oracle:Shekjg34@192.168.10.4 to see if it works (some ftp clients work with this URL)
Or use a .netrc in the user that runs the cronjob home directory with the following:
Code:
machine 192.168.10.4
login oracle
password Shekjg34
and in your script use just "ftp 192.168.10.4<<EOF ..."
 
Old 04-21-2006, 06:10 PM   #3
giteshtrivedi
LQ Newbie
 
Registered: Apr 2006
Posts: 3

Original Poster
Rep: Reputation: 0
Hi friend,

Thanks for replying.

I cann't find .netrc file in oracle user home.Second thing I want to put more then 1 file also also due to I put ftp -i for noninterective mode.Your said ftp:// can you tell me how can I put -i there?

Please give me guidence.I am so much confused.

Thanks a lot in Advance.

Gitesh
 
Old 04-22-2006, 10:26 AM   #4
bathory
Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 10,975

Rep: Reputation: 1343Reputation: 1343Reputation: 1343Reputation: 1343Reputation: 1343Reputation: 1343Reputation: 1343Reputation: 1343Reputation: 1343Reputation: 1343
You have to create the .netrc file since it doesn't exist. And you can use "prompt off" inside your script:
Code:
#!/bin/sh
ftp 192.168.10.4 <<EOF
cd /u05/oralog/starship
bin
prompt off
mput *.ARC
bye
EOF
The other method is not sure that it works with all ftp clients (I've tested it and it works with Suse but not with Slackware). Just replace "ftp 192.168.10.4" with "ftp ftp://oracle:Shekjg34@192.168.10.4" in the above script to see if it works.
 
Old 04-22-2006, 12:26 PM   #5
giteshtrivedi
LQ Newbie
 
Registered: Apr 2006
Posts: 3

Original Poster
Rep: Reputation: 0
Thanks

Hello frinds,

Thanks very much for your valuable help.I have created .netrc in user's $HOME directory and give 600 permission.Now my said script is works fine with cron.

Once again thanks a million to you.

Regards,
Gitesh Trivedi
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Automatic FTP Backup aquaboot Linux - Software 5 06-03-2006 07:34 PM
Automatic FTP greatmenon Linux - Software 1 01-20-2006 11:09 PM
FTP - remote login (automatic?) claudiascotti Linux - Networking 4 05-23-2005 04:14 PM
Automatic RHN Applet using CRON muddyyork Fedora 0 01-22-2004 07:05 PM
Automatic ftp login for WinXP to Linux Alek Linux - Networking 2 10-21-2003 02:17 PM


All times are GMT -5. The time now is 07:22 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration