tag:blogger.com,1999:blog-8884166.post114303661452460844..comments2022-03-26T22:48:33.318-05:00Comments on willCode4Beer: FTP Shell scriptwillCode4Beerhttp://www.blogger.com/profile/14121976149233329281noreply@blogger.comBlogger27125tag:blogger.com,1999:blog-8884166.post-12844886733883310792011-06-29T06:10:59.065-05:002011-06-29T06:10:59.065-05:00how to select local directoryhow to select local directoryAnonymousnoreply@blogger.comtag:blogger.com,1999:blog-8884166.post-11638145992593633672010-12-29T19:18:24.033-05:002010-12-29T19:18:24.033-05:00Hi, I have trouble to create a script. I want to t...Hi, I have trouble to create a script. I want to transfers some txt files from an ubuntu machine from a specific folder to windows machine, but when I debug a shell with ftp I see local & remote path are the same path<br /><br />IP Server ftp: 192.168.1.100<br />ftp user & pas: rick<br /><br />onnected to 192.168.1.100.<br />220-Cerberus FTP Server Personal Edition<br />220-UNREGISTERED<br />220-Welcome to Cerberus FTP Server<br />220 Created by Grant Averett<br />ftp: setsockopt: Bad file descriptor<br />---> SYST<br />500 Not logged in<br />---> USER rick<br />331 User rick, password please<br />---> PASS rick<br />230 Password Ok, User logged in<br />---> TYPE I<br />200 Type Binary<br />---> CWD ftproot<br />250 Change directory ok<br />local: /home/rick/NARANJA/hoy.tar.gz remote: /home/rick/NARANJA/hoy.tar.gz<br />---> PORT 192,168,1,20,135,107<br />200 Port command received<br />---> STOR /home/rick/NARANJA/hoy.tar.gz<br />500 Invalid Path<br />---> QUIT<br />221 Goodbye<br />*************************************<br />My script:<br />#!/bin/bash<br />clear<br />filename="/home/rick/NARANJA/hoy.tar.gz"<br />hostname="192.168.1.100"<br />username="rick"<br />password="rick"<br /> cd /home/rick/NARANJA<br />ftp -ivnd $hostname <<EOF<br />quote USER $username<br />quote PASS $password<br /><br />binary<br />cd ftproot<br />put $filename<br />quit<br />EOFAnonymoushttps://www.blogger.com/profile/04694931724671309803noreply@blogger.comtag:blogger.com,1999:blog-8884166.post-28131468610456874952010-12-29T18:43:52.476-05:002010-12-29T18:43:52.476-05:00Hi I ve tried to create a ftp shell script to mov...Hi I ve tried to create a ftp shell script to move some files from a specific path in ubuntu /home/rick/ABC/files.txt to a host with a different path. When a debug my ftp connection, I see local y remote folder is the same<br />Server ftp: 192.168.1.100<br />user & pass: rick<br />local path:/ home/rick/NARANJA/files.txt<br />remote path change according day, month 6 year in a Windows machine<br />RegardsAnonymoushttps://www.blogger.com/profile/04694931724671309803noreply@blogger.comtag:blogger.com,1999:blog-8884166.post-29331114301136267062010-12-17T03:57:18.534-05:002010-12-17T03:57:18.534-05:00Thanks!
I had to add the -nv option - but wow thi...Thanks!<br /><br />I had to add the -nv option - but wow this really rocks now.<br /><br />Can you point me to some code examples about how I can then compress the file (Gzip) and move it to the archive location?Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-8884166.post-20020460355501838852010-12-13T22:10:09.933-05:002010-12-13T22:10:09.933-05:00thanks ...i wanna learn shell scripting... wnt mor...thanks ...i wanna learn shell scripting... wnt more helpAnonymousnoreply@blogger.comtag:blogger.com,1999:blog-8884166.post-91554801237007363102010-09-21T02:44:15.757-05:002010-09-21T02:44:15.757-05:00i want to take backup of some tables from another ...i want to take backup of some tables from another pg server using ftp configuration of differennt server in script.sh file , can any one help me ?Anonymoushttps://www.blogger.com/profile/15731845348677106913noreply@blogger.comtag:blogger.com,1999:blog-8884166.post-18480690313608583532010-07-17T09:18:31.582-05:002010-07-17T09:18:31.582-05:00Thanks *Beer. You're a lifesaver! I'll rea...Thanks *Beer. You're a lifesaver! I'll read up to figure out how it works! Should help when invoking ne other prompt based apps via bash.Daniyalhttps://www.blogger.com/profile/16634033514755211263noreply@blogger.comtag:blogger.com,1999:blog-8884166.post-34542388882071774472010-07-08T14:35:56.131-05:002010-07-08T14:35:56.131-05:00I am trying to do the same from room directly and ...I am trying to do the same from room directly and it's not working. it's throwing below for the put $filename..<br /><br />Could not create file.Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-8884166.post-43813966568774997892010-06-23T16:57:56.855-05:002010-06-23T16:57:56.855-05:00works for me, thx!works for me, thx!Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-8884166.post-21885322138561870192010-05-23T06:30:17.225-05:002010-05-23T06:30:17.225-05:00OK, I have checked, checked and double checked tha...OK, I have checked, checked and double checked that I have used the right filename/location but I get the following error when using your script:<br /><br />"/home/danielgroves/text.txt: No such file or directory"<br /><br />Any Ideas? <br />I have tried chmodding it to 777.Anonymoushttps://www.blogger.com/profile/13278012238957349199noreply@blogger.comtag:blogger.com,1999:blog-8884166.post-58132733156820612112010-04-01T14:58:06.283-05:002010-04-01T14:58:06.283-05:00ftp -n would work too . Sometimes you get the erro...ftp -n would work too . Sometimes you get the error <br />ftp: u: unknown optionAnonymousnoreply@blogger.comtag:blogger.com,1999:blog-8884166.post-37345610338158655902010-03-12T00:27:00.149-05:002010-03-12T00:27:00.149-05:00didn't work for me "ftp: u: unknown optio...didn't work for me "ftp: u: unknown option " message displayed i used F12Anonymoushttps://www.blogger.com/profile/08858419351435930491noreply@blogger.comtag:blogger.com,1999:blog-8884166.post-70767874206217818852009-12-29T09:15:13.354-05:002009-12-29T09:15:13.354-05:00Thanks for your efforts.
But unfortunatly didn'...Thanks for your efforts.<br />But unfortunatly didn't worked for me.<br />and it is asking me password if i execute it.Not sure why this is happening.<br />please helpShailhttps://www.blogger.com/profile/00932406865649749686noreply@blogger.comtag:blogger.com,1999:blog-8884166.post-49158998341626118822009-08-19T08:07:43.687-05:002009-08-19T08:07:43.687-05:00hi..
Your code is very useful..hi..<br />Your code is very useful..Anonymoushttps://www.blogger.com/profile/06591654655865266804noreply@blogger.comtag:blogger.com,1999:blog-8884166.post-87630011189423021472009-08-18T10:21:45.547-05:002009-08-18T10:21:45.547-05:00nice one, very helpfull.nice one, very helpfull.rageshhttps://www.blogger.com/profile/16762651375103954473noreply@blogger.comtag:blogger.com,1999:blog-8884166.post-39845627116503279682009-08-17T01:00:42.375-05:002009-08-17T01:00:42.375-05:00Thanks a lot!Thanks a lot!Dropped Packethttps://www.blogger.com/profile/11362836986915447031noreply@blogger.comtag:blogger.com,1999:blog-8884166.post-35989559234077155262009-06-04T10:56:05.456-05:002009-06-04T10:56:05.456-05:00Having a problem setting a path and filename on Rh...Having a problem setting a path and filename on Rhel 5.0. I get the error "The system could not find the specified path". It works like a champ if the file is in the same directory as the script. Any suggestions?Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-8884166.post-46065928907176143572009-05-03T01:50:00.000-05:002009-05-03T01:50:00.000-05:00is it possible to retrieve the password from the e...is it possible to retrieve the password from the encrypted file system such as /etc/passwd ?Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-8884166.post-55655910971611006002008-09-01T15:09:00.000-05:002008-09-01T15:09:00.000-05:00To both anonymous'Yes, you should be able to read ...To both anonymous'<BR/><BR/>Yes, you should be able to read the ip out of a file.<BR/><BR/>Even easier, just have the file contain something like:<BR/>export ip=127.0.0.1<BR/>and execute the file from the script. It'll be easier than parsing.<BR/><BR/>For the hostname, just read it from:<BR/>"/etc/hostname"<BR/>Should work just fine.willCode4Beerhttps://www.blogger.com/profile/14121976149233329281noreply@blogger.comtag:blogger.com,1999:blog-8884166.post-29544521532049902462008-08-28T22:48:00.000-05:002008-08-28T22:48:00.000-05:00A bit of an aside but can you direct an FTP based ...A bit of an aside but can you direct an FTP based on the hostname of the puter? ie the same script can be run from multiple puters so I'd like to put something like..<BR/><BR/>if $hostname="thiscomputer"<BR/>ftp -in theothercomputer<BR/>else<BR/>if $hostname="theothercomputer"<BR/>ftp -in this computer<BR/><BR/>Does that look like something that should work?Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-8884166.post-25757409673190630552008-07-25T04:10:00.000-05:002008-07-25T04:10:00.000-05:00Hi This is a nice script ..Is it possible to take ...Hi <BR/>This is a nice script ..Is it possible to take IP address from a file .So that I can add new server IP as column and the script read server IP from file and execute the script for each server ? Email me on <BR/>mohammada@au.specsavers.comAnonymousnoreply@blogger.comtag:blogger.com,1999:blog-8884166.post-52303012207837894172008-04-29T06:39:00.000-05:002008-04-29T06:39:00.000-05:00Great, it works. But Solaris doesn't know the para...Great, it works. But Solaris doesn't know the parameter '-u' :-)Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-8884166.post-58914515880349216172008-02-11T11:39:00.000-05:002008-02-11T11:39:00.000-05:00Hi Sommi6,It's because EOF stands for "End of File...Hi Sommi6,<BR/>It's because EOF stands for "End of File"<BR/><BR/>Probably the simplest way to do what you want is to create a few functions in the bash script that can be called individually.willCode4Beerhttps://www.blogger.com/profile/14121976149233329281noreply@blogger.comtag:blogger.com,1999:blog-8884166.post-46434069368883798342008-02-10T15:50:00.000-05:002008-02-10T15:50:00.000-05:00Why is it that if you put any bash commands after ...Why is it that if you put any bash commands after the second EOF, even a simple 'echo "hello"', you get no response? I was trying to use a lock file, as this script is called by another script and I need to determine if it's still running, since it will have variable lengths of time depending on how many files are being transfered.Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-8884166.post-1168353284116698622007-01-09T09:34:00.000-05:002007-01-09T09:34:00.000-05:00Great, thank you. It work for me.Great, thank you. It work for me.Anonymousnoreply@blogger.com