nixCraft Linux Forum

nixCraft

Linux 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

Register FAQ Members List Calendar Mark Forums Read
  #1 (permalink)  
Old 04-29-2008, 12:17 PM
Junior Member
User
 
Join Date: Apr 2008
My distro: Debian
Posts: 5
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
Sponsored Links
  #2 (permalink)  
Old 04-29-2008, 02:47 PM
rockdalinux's Avatar
Contributors
User
 
Join Date: May 2005
Location: Bangalore
My distro: RHEL, HP-UX, Solaris, FreeBSD, Ubuntu
Posts: 554
Rep Power: 6
rockdalinux is a jewel in the rough rockdalinux is a jewel in the rough rockdalinux is a jewel in the rough
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.
You may have my body & soul, but you will never touch my pride!

If you have knowledge, let others light their candles at it.

Certified to work on HP-UX / Sun Solaris / RedHat
Reply With Quote
  #3 (permalink)  
Old 04-29-2008, 02:58 PM
Junior Member
User
 
Join Date: Apr 2008
My distro: Debian
Posts: 5
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 04-30-2008, 12:38 AM
rockdalinux's Avatar
Contributors
User
 
Join Date: May 2005
Location: Bangalore
My distro: RHEL, HP-UX, Solaris, FreeBSD, Ubuntu
Posts: 554
Rep Power: 6
rockdalinux is a jewel in the rough rockdalinux is a jewel in the rough rockdalinux is a jewel in the rough
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.
You may have my body & soul, but you will never touch my pride!

If you have knowledge, let others light their candles at it.

Certified to work on HP-UX / Sun Solaris / RedHat
Reply With Quote
  #5 (permalink)  
Old 04-30-2008, 09:36 AM
Junior Member
User
 
Join Date: Apr 2008
My distro: Debian
Posts: 5
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 05-02-2008, 01:45 AM
nixcraft's Avatar
Never say die
User
 
Join Date: Jan 2005
Location: BIOS
My distro: Any distro with shell
Posts: 902
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 | My personal blog
Linux Evangelist
Play hard stay cool
Reply With Quote
  #7 (permalink)  
Old 05-02-2008, 09:44 AM
Junior Member
User
 
Join Date: Apr 2008
My distro: Debian
Posts: 5
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

Bookmarks


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 On

Similar Threads

Thread Thread Starter Forum Replies Last Post
shell script for ftp the file vishal_titre Shell scripting 3 12-10-2007 08:40 AM
writing a shell script to find out my shell name jaymob123 Shell scripting 1 10-08-2007 12:36 AM
running command a root in shell scripts chiku Shell scripting 1 07-17-2006 06:39 PM
require shell script puppen Shell scripting 4 04-12-2006 09:42 PM
Shell Script dought Mahesh Shell scripting 3 02-16-2005 12:13 PM


All times are GMT +5.5. The time now is 12:37 AM.


Powered by vBulletin® Version 3.7.2 - Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0

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