LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   gunzip and ftp using a script @ a time (https://www.linuxquestions.org/questions/linux-newbie-8/gunzip-and-ftp-using-a-script-%40-a-time-712701/)

shipon_97 03-19-2009 12:12 AM

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 ... ...

chrism01 03-19-2009 01:02 AM

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

emailbuilder88 03-19-2009 01:04 AM

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).

schneidz 03-19-2009 10:53 AM

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

shipon_97 03-21-2009 10:58 AM

Thx for your kind help ... ...

shipon_97 03-22-2009 01:16 AM

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 .

schneidz 03-22-2009 01:24 PM

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.


All times are GMT -5. The time now is 07:13 AM.