LinuxQuestions.org
Review your favorite Linux distribution.
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, 12:12 AM   #1
shipon_97
Member
 
Registered: Oct 2005
Location: Bangladesh
Posts: 504

Rep: Reputation: 31
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, 01:02 AM   #2
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,355

Rep: Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751
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, 01: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, 10:53 AM   #4
schneidz
LQ Guru
 
Registered: May 2005
Location: boston, usa
Distribution: fedora-35
Posts: 5,313

Rep: Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918
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 12:51 PM.
 
Old 03-21-2009, 10:58 AM   #5
shipon_97
Member
 
Registered: Oct 2005
Location: Bangladesh
Posts: 504

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

Original Poster
Rep: Reputation: 31
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, 01:24 PM   #7
schneidz
LQ Guru
 
Registered: May 2005
Location: boston, usa
Distribution: fedora-35
Posts: 5,313

Rep: Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918
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 01: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 06: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 05:42 AM
Urgent Help: Perl FTP Script Using NET::FTP xboxter Programming 8 05-16-2005 06:57 PM
time out ftp CurlyMo Linux - Newbie 1 02-16-2003 02:46 AM
PHP last time modified script time way off GabeF Programming 2 11-05-2002 08:05 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 08:05 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
Open Source Consulting | Domain Registration