nixCraft Linux Forum

nixCraft

Linux / UNIX Tech Support Forum

Run mv command from ftp shell script

This is a discussion on Run mv command from ftp shell script within the Shell scripting forums, part of the Development/Scripting category; Hi all, I am taking log files every 15 min from remotemachine. My code is ; FRONTEND_HOME=/home/hai/jjsjs/Frontend_log cd /dsd/sds/sdsds/FrontEnd ftp ...


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 29-04-2008, 12:17 PM
Junior Member
User
 
Join Date: Apr 2008
OS: Debian
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 0
subin is on a distinguished road
Default Run mv command from ftp shell script

Hi all,

I am taking log files every 15 min from remotemachine.
My code is ;
FRONTEND_HOME=/home/hai/jjsjs/Frontend_log
cd /dsd/sds/sdsds/FrontEnd
ftp -n 10.22.144.32 << END_INPUT >> /root/scripts/tracking/ftp_frontend.log 2>&1
user hai hai
asc
cd $FRONTEND_HOME
prompt
mget logger.log.*
bye
END_INPUT


But i need to move the logfiles to other directory(from remotemachine) after my "mget" command .. i tried mv command but its not working ... Help will be highly appreciated..

Thanks
Subin
Reply With Quote
  #2 (permalink)  
Old 29-04-2008, 02:47 PM
rockdalinux's Avatar
Is that all you got?
User
 
Join Date: May 2005
Location: Planet Vegeta
OS: Redhat
Posts: 708
Thanks: 15
Thanked 19 Times in 18 Posts
Rep Power: 10
rockdalinux is a glorious beacon of light rockdalinux is a glorious beacon of light rockdalinux is a glorious beacon of light rockdalinux is a glorious beacon of light rockdalinux is a glorious beacon of light rockdalinux is a glorious beacon of light
Default

Run mv command after END_INPUT
Code:
FRONTEND_HOME=/home/hai/jjsjs/Frontend_log
 cd /dsd/sds/sdsds/FrontEnd
 ftp -n 10.22.144.32 << END_INPUT >> /root/scripts/tracking/ftp_frontend.log 2>&1
 user hai hai 
 asc
 cd $FRONTEND_HOME
 prompt
 mget logger.log.*
 bye
 END_INPUT
 mv logger.log.* /some/where/else
__________________
Rocky Jr.
What's wrong? I hope I am not making you uncomfortable...

Never send a boy to do a mans job.
Reply With Quote
  #3 (permalink)  
Old 29-04-2008, 02:58 PM
Junior Member
User
 
Join Date: Apr 2008
OS: Debian
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 0
subin is on a distinguished road
Default

Hello.

I need to move the remote location log files which i already took using mget command not the local machine files


Thanks in advance
Reply With Quote
  #4 (permalink)  
Old 30-04-2008, 12:38 AM
rockdalinux's Avatar
Is that all you got?
User
 
Join Date: May 2005
Location: Planet Vegeta
OS: Redhat
Posts: 708
Thanks: 15
Thanked 19 Times in 18 Posts
Rep Power: 10
rockdalinux is a glorious beacon of light rockdalinux is a glorious beacon of light rockdalinux is a glorious beacon of light rockdalinux is a glorious beacon of light rockdalinux is a glorious beacon of light rockdalinux is a glorious beacon of light
Default

Have tried rename command. If rename is not suppored on remote ftp box try lftp client it has mv command built into it. ftp command client is not powerful enough to mv files.
__________________
Rocky Jr.
What's wrong? I hope I am not making you uncomfortable...

Never send a boy to do a mans job.
Reply With Quote
  #5 (permalink)  
Old 30-04-2008, 09:36 AM
Junior Member
User
 
Join Date: Apr 2008
OS: Debian
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 0
subin is on a distinguished road
Default

Hi Rocky,

Thanks alot for ur timely help...
I tried lftp and mv is working for single files.. How can i move multiple files at a time ? I tried " mv logger.log.* arch/ " and it is giving error " no such file or directory error"....


Thnks in advance
Subin
Reply With Quote
  #6 (permalink)  
Old 02-05-2008, 01:45 AM
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:
glob mv pattern dest
glob mv logger.log.* arch/
__________________
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
  #7 (permalink)  
Old 02-05-2008, 09:44 AM
Junior Member
User
 
Join Date: Apr 2008
OS: Debian
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 0
subin is on a distinguished road
Default

Hi all,

I tried glob mv logger_cc.log.* arch/ command

But it is not working for me... it is giving me the message "Usage: mv <file1> <file2>" ...

Can any one look into this ??

Thanks and regards
Subin
Reply With Quote
Reply


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
[Solved] Shell script for ftp the file vishal_titre Shell scripting 4 21-08-2009 03:50 PM
writing a shell script to find out my shell name jaymob123 Shell scripting 1 08-10-2007 12:36 AM
running command a root in shell scripts chiku Shell scripting 1 17-07-2006 06:39 PM
require shell script puppen Shell scripting 4 12-04-2006 09:42 PM
Shell Script dought Mahesh Shell scripting 3 16-02-2005 12:13 PM


All times are GMT +5.5. The time now is 04:08 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