08-09-2009
SFTP script
Actually I'm on AIX. Here's a general algorithm on what i'm trying to do.
first_time = true
while /usr/bin/true
do
if first_time ()
ftp get file,
name it as file_1
first_time=false
sleep 100
else
get file, name it as file_2
file_2_size =ls -l | tr -s " " | cut -d" " -f5
file_1_size =ls -l | tr -s " " | cut -d" " -f5
if file_2_size == file_1_size
then
exit loop
else (if file_2.size > file_1.size then
copy file_1 = file_2
sleep 100
fi
fi
done
I guess I need this transalated to unix format. Thanks for the help.
-Neel
---------- Post updated at 12:15 PM ---------- Previous update was at 12:11 PM ----------
Actually this is a second option, if somehow I can do the sleep on the remote server and check the file sizes (before and after) then that should be better than downloading the files to the client and doing the compare.
Thanks -Neel
9 More Discussions You Might Find Interesting
1. Filesystems, Disks and Memory
Hi folks...
some process is writing a file....
as soon as the process starts the file comes there, and its growin..
now i in another script want to ftp the file. i don't know if the file is complete or not.
the process which writes the file is some other application and hence can't... (0 Replies)
Discussion started by: sade
0 Replies
2. AIX
Hi
I am looking for a way to confirm whether a core File is complete or Truncated
Is there any way
from
Khan (2 Replies)
Discussion started by: khan_069
2 Replies
3. HP-UX
hi
I have a core file from customer and i am looking for a way to know whether its complete or truncated?
I have a procedure to check core file on solaris , is there any way to know whether core is truncated on HP-UX?
from
khan (1 Reply)
Discussion started by: khan_069
1 Replies
4. Shell Programming and Scripting
Hi
I have to write a script, that will find out the lists of files in a particular directory, which are created between 30-60 min intervals. (3 Replies)
Discussion started by: velocitnitin
3 Replies
5. Shell Programming and Scripting
Hello All,
we have scenarion where we need to pull the Files from Windows to Unix Box through SFTP protocol. as per our analysis we did install the cygwin package on the Windows Box to have the openSSH package functionality.
1.Will openSSH help us to achieve the functionality what we are... (3 Replies)
Discussion started by: Amey Joshi
3 Replies
6. Shell Programming and Scripting
hi,
Im using the following code for FTP
#!/usr/bin/ksh
ftp -v -n "10.29.45.11" << cmd
user "mahesva" "mahesva123"
get rtl.tar
quit
cmd
Below is the log when i run the above code
**********************************
Connected to 10.29.45.11.
220 (vsFTPd 2.0.1)
530 Please login with USER... (20 Replies)
Discussion started by: dll_fpga
20 Replies
7. UNIX for Dummies Questions & Answers
noted down (44 Replies)
Discussion started by: mirwasim
44 Replies
8. Shell Programming and Scripting
hi,
how can i check whether the sftp connectivity is successful or not??
i am using expect script to connect to sftp..
sftp_script
spawn /usr/bin/sftp abc@ftp.xyz.com
expect "abc@ftp.xyz.com's password:"
send "password\r"
expect "sftp>"
send "mput *.txt\r"
expect "sftp>"
send "bye\r"... (8 Replies)
Discussion started by: Little
8 Replies
9. Shell Programming and Scripting
Hi,
Can any1 provide the code for my req:
I am loading few set of files into database through one unix script. I ll try to describe the process:
load_cdr-->main script
Source Feeds are A & B.
File in A-akm.dat
File in B-bkm.dat
Now my script runs through cron jobs everyday...and for both... (6 Replies)
Discussion started by: gnnsprapa
6 Replies
true(1) General Commands Manual true(1)
NAME
true, false - Returns a standard exit value
SYNOPSIS
true
false
STANDARDS
Interfaces documented on this reference page conform to industry standards as follows:
true: XCU5.0
false: XCU5.0
Refer to the standards(5) reference page for more information about industry standards and associated tags.
DESCRIPTION
The true command returns a 0 (zero) exit value. The false command returns a nonzero exit value. These commands are usually used in input to
shell commands.
NOTES
The special built-in utility : (colon) is sometimes more efficient than the true command.
EXIT STATUS
[Tru64 UNIX] The nonzero value returned by the false command may vary from system to system.
EXAMPLES
To construct a loop in a shell procedure, enter: while true do date sleep 60 done
This procedure displays the date and time once a minute. To stop it, press the Interrupt key sequence.
SEE ALSO
Commands: csh(1), ksh(1), Bourne Shell sh(1b), POSIX shell sh(1p)
Standards: standards(5)
true(1)