FTP session not working on cron


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting FTP session not working on cron
# 8  
Old 07-14-2015
Is this really the output from a cron job then, or did you run it off the command line?

Anyway, the value for HOME is set by the login user, not a user to su to, although you can change it if you run the profiles.

You would need to either:-
  • Copy the .netrc into the correct place (do you trust that location)
  • Force the HOME value to be correct by adding export HOME=/ into your script before you call ftp
Can you have a go with those?


Robin
# 9  
Old 07-14-2015
Quote:
Originally Posted by rbatte1
Is this really the output from a cron job then, or did you run it off the command line?

Anyway, the value for HOME is set by the login user, not a user to su to, although you can change it if you run the profiles.

You would need to either:-
  • Copy the .netrc into the correct place (do you trust that location)
  • Force the HOME value to be correct by adding export HOME=/ into your script before you call ftp
Can you have a go with those?


Robin
My apologies, I misread your previous reply. I ran those commands from the command line and not via cron. I will try this again in a while (currently have no access) and let you know on the results soon!

Robin
# 10  
Old 07-24-2015
Quote:
Originally Posted by rbatte1
Is this really the output from a cron job then, or did you run it off the command line?

Anyway, the value for HOME is set by the login user, not a user to su to, although you can change it if you run the profiles.

You would need to either:-
  • Copy the .netrc into the correct place (do you trust that location)
  • Force the HOME value to be correct by adding export HOME=/ into your script before you call ftp
Can you have a go with those?


Robin

Hi Robin,

I added the line export HOME=/export/home/user1 and now the cron job is working perfectly! Thanks so much for the help! Smilie

Robin

Last edited by rbatte1; 07-24-2015 at 07:01 AM.. Reason: Added ICODE tags
# 11  
Old 07-24-2015
Just be wary that changing the value of HOME can affect other things that follow it. If you script then exits, then this is probably not a problem, but if you then go off to do other things, you might be better to:-
Code:
real_HOME=$HOME
export HOME=/export/home/user1

# Do your ftp bit here

export HOME=$real_HOME


Kind regards, Robin,
Robin
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Using pipe in FTP session

Hi All , I want to use pipe in ftp session . Please let me know if there is any possibility I have done FTP to a remote host with proper username and password Now I want to take the latest file in a directory . The below is not workinf ftp> ls -lrt |... (4 Replies)
Discussion started by: Sandeep Lade
4 Replies

2. Shell Programming and Scripting

Script not working in cron but working fine manually

Help. My script is working fine when executed manually but the cron seems not to catch up the command when registered. The script is as follow: #!/bin/sh for file in file_1.txt file_2.txt file_3.txt do awk '{ print "0" }' $file > tmp.tmp mv tmp.tmp $file done And the cron... (2 Replies)
Discussion started by: jasperux
2 Replies

3. Shell Programming and Scripting

Script is not working from cron while working manually

Hello, I am facing a very strange problem when I run my script manuallu ./Fetchcode which is using to connect with MKS integrity from linux end it workks fine but when I run it from cron it doesn't work.Can someone help me 1) How could I check my script when it is running from cron like... (3 Replies)
Discussion started by: anuragpgtgerman
3 Replies

4. Shell Programming and Scripting

Non-interactive FTP within SSH session not working

Hello everyone! I am trying to log-in to a remote server over SSH, transfer file1 there, perform some checks, capture the results in file2 and transfer file2 back to my local server - all of this non-interactively. Initially, I tried to do this within a singe SSH session, using the following... (2 Replies)
Discussion started by: Subu1987
2 Replies

5. Shell Programming and Scripting

Cron job vanishes if i disconnect the session upruptly

Hi Am logging in to the server as root. Using the export EDITOR=vi option before editing the cron file editing the crontab entry using crontab -e option the additional jobs which i added can be seen immediately, but when i disconnect the session upruptly the cron entry vanishes the next time... (4 Replies)
Discussion started by: aemunathan
4 Replies

6. Shell Programming and Scripting

executing commands through FTP session

Dears, i want to execute unix commands through FTP session those commands like grep XXXXX file name > new file tar new file ..... etc Please let me know how to so thank you (3 Replies)
Discussion started by: faiz
3 Replies

7. UNIX for Dummies Questions & Answers

FTP Session

In FTP session, how could know the present working directory in local machine? pwd command gives the present working directory for remote machine only. (2 Replies)
Discussion started by: siba.s.nayak
2 Replies

8. Shell Programming and Scripting

Looping in FTP session

Hi I am trying rename multiple files in a remote location by connecting through FTP. How do i do this? I get error as for is not FTP command. I looked the FAQ for scripting but it is doesnt relate to my post. Please help. Thanks ftp -in >Error.log <<! open $HOST user $User $Pwd for... (2 Replies)
Discussion started by: appsguy616
2 Replies

9. Shell Programming and Scripting

display while in ftp session

Is there any command which displays date while i am in a ftp session? I tried the date command, but in vain ftp> date ?Invalid command ftp> Can someone please help me. Thanks (2 Replies)
Discussion started by: vivek_damodaran
2 Replies

10. Shell Programming and Scripting

Loops within ftp shell session

Hi guys, i need to script the sending of multiple files through one ftp session. I have done this so far: ---------------------------------------------------------------- #!/bin/sh USER=myuser PASSWD=mypass filenum=$1 x=0 ftp -n 159.167.95.199 <<SCRIPT user $USER $PASSWD binary while ... (4 Replies)
Discussion started by: zaff
4 Replies
Login or Register to Ask a Question