nixCraft Linux Forum

nixCraft

Linux / UNIX Tech Support Forum

Shell script for ftp the file

This is a discussion on Shell script for ftp the file within the Shell scripting forums, part of the Development/Scripting category; Hi all , i need your help , it's very urgent i want the shell script to ftp the file ...


Go Back   nixCraft Linux Forum > Development/Scripting > Shell scripting

Linux answers from nixCraft.


Shell scripting You can discuss the shell scripting, request shell scripts and scripting techniques

Reply

 

LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 14-08-2007, 03:53 PM
Junior Member
User
 
Join Date: May 2007
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 0
vishal_titre is on a distinguished road
Default Shell script for ftp the file

Hi all ,
i need your help , it's very urgent
i want the shell script to ftp the file from perticular server and copy in to another server.

Thanks
Reply With Quote
  #2 (permalink)  
Old 15-08-2007, 11:46 PM
nixcraft's Avatar
Never say die
User
 
Join Date: Jan 2005
Location: BIOS
OS: RHEL
Scripting language: Bash and Python
Posts: 2,710
Thanks: 11
Thanked 245 Times in 184 Posts
Rep Power: 10
nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute
Default

Code:
#!/bin/sh
BAK="/backup" # store all backup files here
FTPU="ftp-username"
FTPP="ftp-password"
FTPS="ftp-server-ip"
NOW=$(date +"%d-%m-%Y")
lftp -u $FTPU,$FTPP -e "mkdir backup/$NOW;cd backup/$NOW; mput $BAK/*; quit" $FTPS
You must have lftp ftp client installed. Above script will copy all files from /backup to ftp server backup/dd-mm-yyyy format.

See More script @ Shell Script Directory : FTP
__________________
Vivek Gite
Linux Evangelist
Be proud RHEL user, and let the world know about your enterprise choices! Join RedHat user group.
Always use CODE tags for posting system output and commands!
Do you run a Linux? Let's face it, you need help
Reply With Quote
  #3 (permalink)  
Old 17-08-2007, 01:46 PM
Junior Member
User
 
Join Date: May 2007
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 0
vishal_titre is on a distinguished road
Default Need script for following . plz help it's very urgent

Thanks for your reply , i need your help agin to solve my following problem.

I want the command that should look for files which were created in the last 2 hrs.
For example let's say the following files were created in the server

8 am - mpsacba_20070815_08
9 am - mpsacba_20070815_09
10 am - mpsacba_20070815_10
11 am - mpsacba_20070815_11
12 pm - mpsacba_20070815_12
1 pm - mpsacba_20070815_13

When our process runs at 10 am it should pick up mpsacba_20070815_09
and mpsacba_20070815_10 (which are the files which are created since
the last run). it should pick up those files where were created since the last
time our process ran.
Reply With Quote
  #4 (permalink)  
Old 10-12-2007, 08:40 AM
anilvrathod's Avatar
Junior Member
User
 
Join Date: Dec 2007
Location: Pune
OS: Red Hat
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 0
anilvrathod is on a distinguished road
Default

Dear friend use this, it will help you

Code:
#!/bin/sh
FILE_NAME="path_of_file"
HOST='IP Addr. of ftp server'
USER='user_name'
PASSWD='user_passwd'
ftp -nv <<EOF
open $HOST
user $USER $PASSWD
cd db_backups/PUNE/
put $FILE_NAME
EOF
__________________
Anil V. Rathod
RHCE
System Administrator
Styling Studio, ERC
INCAT | A TATA Technologies Company
www.incat.com www.tatatechnologies.com Email- anil.rathod@incat.com
------------------------------------------------
Cell No. +91 9011094209
------------------------------------------------

Last edited by nixcraft; 21-08-2009 at 07:10 PM. Reason: code tag added
Reply With Quote
  #5 (permalink)  
Old 21-08-2009, 03:50 PM
bhargav_kesavan's Avatar
Junior Member
User
 
Join Date: Aug 2009
OS: Debian
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 0
bhargav_kesavan is on a distinguished road
Thumbs up Thank you.

Anil,

Many thanks for the post. This is really useful.
Reply With Quote
Reply

Tags
ftp , ftp scripts , linux ftp login script , shell scripting


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 
Thread Tools
Display Modes

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
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads

Thread Thread Starter Forum Replies Last Post
shell script to read a line in gps receiver log file and append that line to new file gudivada213 Shell scripting 2 28-06-2009 09:10 PM
shell script output to log file in /var/log/ asim.mcp Shell scripting 6 13-05-2009 04:04 PM
Shell Script To Outputs File Permissions of Most Recently Modified File glen_4455 Shell scripting 1 25-08-2008 02:39 PM
shell script to search specific file from txt file inside zip file and extract it aasif.shaikh Shell scripting 2 31-05-2008 06:44 PM
error shell script no such file or directory /bin/sh Linux software 1 08-01-2006 08:34 PM


All times are GMT +5.5. The time now is 04:10 PM.


Powered by vBulletin® Version 3.8.5 - Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.3.2
©2005-2010 nixCraft. All rights reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38