LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 03-19-2009, 01:12 AM   #1
shipon_97
Member
 
Registered: Oct 2005
Location: Bangladesh
Posts: 484

Rep: Reputation: 30
gunzip and ftp using a script @ a time


Friends ,

Using the following script I can FTP a file from a remote machine but I cannot
gunzip that file at a time .The script is :

-----------------------------------
x=scott.dmp.gz
ftp -i -v -n 192.168.1.1 <<END_FTP
user oracle Oracle
binary
cd /dump
get $x
bye
gunzip $x
-------------------------------------
Would anybody plz tell me , how can I gunzip that file using a one script .

Waiting for reply ... ...
 
Old 03-19-2009, 02:02 AM   #2
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.8, Centos 5.10
Posts: 17,240

Rep: Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324
x=scott.dmp.gz
ftp -i -v -n 192.168.1.1 <<END_FTP
user oracle Oracle
binary
cd /dump
get $x
bye
END_FTP
gunzip $x


The ftp cmd continues until it see the end marker
 
Old 03-19-2009, 02:04 AM   #3
emailbuilder88
LQ Newbie
 
Registered: May 2005
Posts: 23

Rep: Reputation: 1
Looks to me like you're missing the matching "END_FTP" tag so the gunzip $x is getting sent to the FTP server (yes, even though you've sent "bye" before that).
 
Old 03-19-2009, 11:53 AM   #4
schneidz
LQ Guru
 
Registered: May 2005
Location: boston, usa
Distribution: fc-15/ fc-20-live-usb/ aix
Posts: 5,026

Rep: Reputation: 845Reputation: 845Reputation: 845Reputation: 845Reputation: 845Reputation: 845Reputation: 845
may i suggest scp since that wasdesigned for automating tasks unlike ftp which is designed to prompt the user for info...

Last edited by schneidz; 03-22-2009 at 01:51 PM.
 
Old 03-21-2009, 11:58 AM   #5
shipon_97
Member
 
Registered: Oct 2005
Location: Bangladesh
Posts: 484

Original Poster
Rep: Reputation: 30
Thx for your kind help ... ...
 
Old 03-22-2009, 02:16 AM   #6
shipon_97
Member
 
Registered: Oct 2005
Location: Bangladesh
Posts: 484

Original Poster
Rep: Reputation: 30
Friends ,


would you plz help me again .

ftp -i -v -n 192.168.1.1 <<END_FTP
user oracle Oracleconsole
binary
cd /dmfs/ababil_dump
get $x
END_FTP
export ORACLE_SID=$z
sqlplus "/ as sysdba" << !
alter user system identified by sys123;
create or replace directory test_dir as '/rptdata/test_dir';
exit;
cd /rptdata/test_dir
/usr/bin/gunzip scott.dump.gz
impdp system/sys123@$z directory=test_dir dumpfile=scott.dump content=all remap_schema=ababil:user1


In the above script, when I make exit from the oracle then I want to run the last 3 lines . But last 3 lines are not executed. Can you plz help me .. how can I execute the last 3 lines .
 
Old 03-22-2009, 02:24 PM   #7
schneidz
LQ Guru
 
Registered: May 2005
Location: boston, usa
Distribution: fc-15/ fc-20-live-usb/ aix
Posts: 5,026

Rep: Reputation: 845Reputation: 845Reputation: 845Reputation: 845Reputation: 845Reputation: 845Reputation: 845
Code:
ssh oracle@192.168.1.1 /usr/bin/gunzip /rptdata/test_dir/scott.dump.gz
ssh oracle@192.168.1.1 impdp system/sys123@$z directory=/rptdata/test_dir dumpfile=scott.dump content=all remap_schema=ababil:user1
you can probably put the 2 commands on the same line somehow.
special characters mite need to be escaped somehow.

Last edited by schneidz; 03-22-2009 at 02:25 PM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Long time reader, first time poster (LTR FTP) sirlancealot LinuxQuestions.org Member Intro 1 03-10-2008 07:59 PM
time on our RH linux FTP server is four hours ahead, but desktop time is correct?? dgr Linux - Newbie 10 10-09-2007 06:42 AM
Urgent Help: Perl FTP Script Using NET::FTP xboxter Programming 8 05-16-2005 07:57 PM
time out ftp CurlyMo Linux - Newbie 1 02-16-2003 03:46 AM
PHP last time modified script time way off GabeF Programming 2 11-05-2002 09:05 PM


All times are GMT -5. The time now is 09:48 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration