12-19-2006
Following FTP steps has solved the problem.
ftp -vn $HOST <<END_SCRIPT > $LOG/delete_files.log 2>&1
quote USER username
quote PASS password
bin
prompt off
cd $PICKUP
mget *
bye
END_SCRIPT
EXIT_STATUS=$?
if [[ $EXIT_STATUS -ne 0 ]]
then
mailx -s \'"Files FTP failed'"
user@xyz.com < $MSG/ftp_fail.msg
exit 1
else
mailx -s \'"Files FTP successful'"
user@xyz.com < $MSG/ftp_succ.msg
fi
exit 0
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi,
Im creating a script that is supposed to run commands on remote server using sftp.
My script is as below:
#!/bin/ksh
sftp remote_server
mypassword
cd /u08/mydir/allfiles
mget *
..
But this is what I got when I runned the script:
Connecting to remote server...... (3 Replies)
Discussion started by: luna_soleil
3 Replies
2. Shell Programming and Scripting
Hi,
I need to copy few files from remote server to local server.
I write a shell script to connect to the remote server using ftp and go to that path. Now i need to copy those files in the remote directory to my local server with the timestamp of all those files shouldnt be changed.
... (5 Replies)
Discussion started by: arunkumarmc
5 Replies
3. Shell Programming and Scripting
unix shell script (2 Replies)
Discussion started by: giridhar276
2 Replies
4. Shell Programming and Scripting
Hi All,
I want to search for .log files from folders and sub folders in remote server and FTP them to one particular folder in the local machine. I dont want to copy the entire directory tree structure, just have to take all the .log files from all the folders by doing a recursive search from the... (3 Replies)
Discussion started by: dassv
3 Replies
5. UNIX for Dummies Questions & Answers
Good evening
I need your help pease
I know there are 2 commands(diff, or cp) to compare files in a directory. but the question arises:
1. can i compare zip files or ive got to unzip them?
2. how can i compare 2 files from a local to a remote server? (is there any special commad or ive got... (4 Replies)
Discussion started by: alexcol
4 Replies
6. UNIX for Dummies Questions & Answers
Hi experts,
I 'm newbie to unix world, now I have task to copy the latest files from remote server to my local. I believe this must be very common request in this community. I want you do it one more time for me please.
My requirement is something like this:
I receive files in the below... (3 Replies)
Discussion started by: parpaa
3 Replies
7. Solaris
Hi,
I am trying to automate the process of fetching files from remote server to local server through sftp. I have the username and password for the remote solaris server. But I need to give password manually everytime i run the script.
Can anyone help me in automating the script such that it... (3 Replies)
Discussion started by: ssk250
3 Replies
8. Shell Programming and Scripting
Hi guys,
So i am in server1 and i have to login to server 2, 3,4 and run some script there(logging script) and output its result. What i am doing is running the script in server2 and outputting it to a file in server 2 and then Scp'ing the file to server1. Similarly i am doing this for other... (5 Replies)
Discussion started by: srkmish
5 Replies
9. UNIX for Advanced & Expert Users
Hi,
I am working on an application which runs on an Informatica Red-Hat 5.10 Linux Server.
The application involves several Informatica ETL workflows which generate 100s of Text files with lot of data. Many of the files will each be up to 5 GB in size.
Currently the Informatica server itself... (7 Replies)
Discussion started by: waavman
7 Replies
10. Shell Programming and Scripting
Hello all,
i'm trying to create a report by greping a pattern on multiple remote hosts and creta a simple report,
actually i did this, is ther any better way to do this.
#!/bin/bash
for host in `cat RemoteHosts`
do
ssh $host -C 'hostname 2>&1; grep ERROR /var/log/WebServer.log.2019-09-21... (0 Replies)
Discussion started by: charli1
0 Replies
FTP_PUT(3) 1 FTP_PUT(3)
ftp_put - Uploads a file to the FTP server
SYNOPSIS
bool ftp_put (resource $ftp_stream, string $remote_file, string $local_file, int $mode, [int $startpos])
DESCRIPTION
ftp_put(3) stores a local file on the FTP server.
PARAMETERS
o $ftp_stream
- The link identifier of the FTP connection.
o $remote_file
- The remote file path.
o $local_file
- The local file path.
o $mode
- The transfer mode. Must be either FTP_ASCII or FTP_BINARY.
o $startpos
-The position in the remote file to start uploading to.
RETURN VALUES
Returns TRUE on success or FALSE on failure.
EXAMPLES
Example #1
ftp_put(3) example
<?php
$file = 'somefile.txt';
$remote_file = 'readme.txt';
// set up basic connection
$conn_id = ftp_connect($ftp_server);
// login with username and password
$login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass);
// upload a file
if (ftp_put($conn_id, $remote_file, $file, FTP_ASCII)) {
echo "successfully uploaded $file
";
} else {
echo "There was a problem while uploading $file
";
}
// close the connection
ftp_close($conn_id);
?>
SEE ALSO
ftp_pasv(3), ftp_fput(3), ftp_nb_fput(3), ftp_nb_put(3).
PHP Documentation Group FTP_PUT(3)