Languages and Scripting

Re: gunzip doesn't run in shell script

 
SOLVED
Go to solution
S Nelson_1
Occasional Contributor

gunzip doesn't run in shell script

I have a script that installs net-snmp. For some reason the gunzip line doesn't complete. Everything else works and the script is successful every time if ran locally. I'm currently pushing this out with an older version of Tivoli.

This is the line that fails:
gunzip net-snmp-5.4-1-HP-UX_B.11.11_9000_800.tar.gz

I can't seem to figure out why it's failing on this line. But i know the unzip never seems to complete. It might not be starting.

This is the error output I recieve:
------Standard Error Output------
/var/tmp/aaaa00219[80]: gunzip: not found.
tar: cannot open net-snmp-5.4-1-HP-UX_B.11.11_9000_800.tar
mv: /usr/local/share/snmp/snmpd.conf: rename: No such file or directory
./SnmpMaster[3]: /usr/local/sbin/snmpd: not found.


The lack of the gunzip causes the remaining pieces of the script to fail as well.

I have attached the script

Any input is greatly appreciated.
no
9 REPLIES 9
Patrick Wallek
Honored Contributor
Solution

Re: gunzip doesn't run in shell script

It looks like you need to specify the FULL PATH to the gunzip executable.

Something like:

/usr/contrib/bin/gunzip....

or where ever your gunzip is located.
Steven Schweda
Honored Contributor

Re: gunzip doesn't run in shell script

> /var/tmp/aaaa00219[80]: gunzip: not found.

That's a clue.

> [...] specify the FULL PATH [...]

That's one (good) way. Doing the same thing
for "tar" (and every other command) might be
wise, too. Or, you could set PATH to
something which catches all the things which
you wish to use.

> gunzip net-snmp-5.4-1-HP-UX_B.11.11_9000_800.tar.gz

> tar: cannot open net-snmp-5.4-1-HP-UX_B.11.11_9000_800.tar

While you're fixing things, unless you
_really_ want the expanded "tar" archive on
your disk, why not save some disk space? For
example:

gzip -cd .tar.gz | tar xf -
Kapil Jha
Honored Contributor

Re: gunzip doesn't run in shell script

Yups...you need to give full path of gunzip else u can specify he path as well in script.

BR,
Kapil+
I am in this small bowl, I wane see the real world......
izad
Honored Contributor

Re: gunzip doesn't run in shell script

Hi Nelson,

Pls change your script from

gunzip net-snmp-5.4-1-HP-UX_B.11.11_9000_800.tar.gz

to this

/path/to/gunzip /path/to/HP-UX_B.11.11_9000_800.tar.gz

As per the output, your nodes can neither find where gunzip is nor ur tgz file.

regards,
I hate quotations. Tell me what you know !
Steven Schweda
Honored Contributor

Re: gunzip doesn't run in shell script

> [...] nor ur tgz file.

No, it couldn't find the ".tar" file, because
"gunzip" didn't create it by expanding the
".tar.gz" file. There never was a ".tgz"
file.

> regards,

Didn't you mean "rgds"? (Why make _some_ of
your posting easy to read?)
Suraj K Sankari
Honored Contributor

Re: gunzip doesn't run in shell script

Hi,
>>/var/tmp/aaaa00219[80]: gunzip: not found.

This error means your shell doesnâ t find the gunzip command in this case you can give the full path of the gunzip command or else you can set the PATH of gunzip in your existing PATH.

Suraj
S Nelson_1
Occasional Contributor

Re: gunzip doesn't run in shell script

Thanks everyone. This was definitely my problem. I found that the path is not consistent on all of our systems. Which makes sense why it worked on some and not others.

Thanks Again!

Sean
no
JASONBANGARAM
Visitor

Re: gunzip doesn't run in shell script

Can't we do the same with adding to PATH or something else, rather then giving the whole path ?

ranganath ramachandra
Esteemed Contributor

Re: gunzip doesn't run in shell script


@JASONBANGARAM wrote:

Can't we do the same with adding to PATH or something else, rather then giving the whole path ?


One reason I can think of for specifying the whole path is that you want to always pick up that command from only that path. For example, you might have both HP-UX tar and GNU tar installed in /usr/bin and /usr/local/bin respectively, but you want to use the GNU tar because of some features you want. The order of the paths you specify in PATH might not always help such situations. Imagine another command with similar HP-UX and GNU versions, only this time you want to use the HP-UX version. The sequence requirements for paths in PATH will be contradictory.

 
--
ranga
(i work for hpe)

Accept or Kudo