I'm trying to run a set of commands on a remote machine using ssh in a shell script. One of the commands is unzip. But when the execution reaches this command, the script fails with an error that unzip is not found. Below is the code and the error snippet.
I have checked on the remote machine that unzip command exists. I also tried hardcoding the actual file's name as an argument to the unzip, with no luck! The error remains the same.
Any idea why am getting this error?
Last edited by farahzaiba; 01-25-2009 at 10:17 PM..
My only worry is whether the path to unzip will change from machine to machine. I don't want the path to unzip to be a part of my script. Any ideas as to how I can avoid this?
I'm trying to run a set of commands on a remote machine using ssh in a shell script. One of the commands is unzip. But when the execution reaches this command, the script fails with an error that unzip is not found. Below is the code and the error snippet.
Pleae put code inside [code] tags.
Quote:
sh: unzip: not found.
I have checked on the remote machine that unzip command exists. I also tried hardcoding the actual file's name as an argument to the unzip, with no luck! The error remains the same.
Any idea why am getting this error?
If it can't find unzip, a path to its argument isn't going to help; try using the full path to unzip.
My only worry is whether the path to unzip will change from machine to machine. I don't want the path to unzip to be a part of my script. Any ideas as to how I can avoid this?
Make sure that the directory containing unzip is in your PATH on all machines.
The double ampersand (&&) ends the command on the local machine.
So the local machine sees and executes (or tries to execute) 4 commands: ssh, cp, cd and unzip.
Also, the out file is being created on the local macine.
You may be able to quote them so the local machine sees them as arguments and passes them along.
I think the remote will then see them as separators.
------------------
Update:
Never mind. Now that I have it in a code block, I see that you have the quotes in a place that should make it work.
I don't know why it doesn't work, unless as discussed, unzip isn't on the path on the remote machine.
Last edited by KenJackson; 01-25-2009 at 10:52 PM..
Reason: update
I have two linux servers viz 12.7.44.18 and 12.7.45.18
I wish to ssh from both these server to a destination AiX server 12.7.33.18
The ssh works from 12.7.44.18 -> 12.7.33.18 but fails from 12.7.45.18 -> 12.7.33.18
The openssl version on both linux source 12.7.44.18 and 12.7.45.18 is the... (7 Replies)
I have two users on dest_host server viz wlsadm & wasadm.
From src_host server with root user I m able to passwordless login to wlsadm@dest_host however, the same fails for wasadm@dest_host
Below is the debug for both first the working ssh and then the non-working ssh.
Works:
... (6 Replies)
I have a constraint to follow organization policy. So i do not have much liberty.
ssh -i /opt/nonprod user1@hostone -t bash works while ssh -i /opt/nonprod -t bash user1@hostone fails
How can I get this to work when I am enforced to put -t bash before the user@hostname ?
Will share debug... (3 Replies)
Hi
I have a zip file at linux while unziping those files using unzip command in rare scenario it copy the 0 size file to the destination.
These files are .so file with their soft link.It is happening for one of .so file. (2 Replies)
Hi,
I am triggering a windows exe file using the below command.
ssh user@remoteserver command.exe -option1:xx /option2:yy
This command is working fine from windows command prompt. When I am triggering the same command from ssh I get the error message cant load
Any ideas to deal with... (2 Replies)
The below while loop is in ksh on a SunOs server: SPARC-Enterprise 5.10
The ksh version is: Version M-11/16/88i
The intention of the below while loop is to read through a list of file names in files.txt and
delete each file from a server, one at a time. The delete works, the problem is that if... (6 Replies)
Unable to set ssh passwordless authentication
I am unable to ssh with passwordless authentication from Windows client onto UBuntu server. The ssh version on UBuntu is OpenSSH_5.8p1 Debian-7ubuntu1, OpenSSL 1.0.0e , while SSH on Windows Client is OpenSSH_5.1p1, OpenSSL 0.9.8k. I turned on ssh... (5 Replies)
I have a tar file that contains multiple .Z files. Hence I need to issue a tar command followed by a gzip command to fully extract the files. How do I do it in a single command?
What I'm doing now is
tar xvf a.tar (this will output 1.Z and 2.Z)
gzip -d *.Z (to extract 1.Z and 2.Z) (9 Replies)
I'm trying to write a script using expect. I'd like the script to execute several commands when the ssh succeeds and i want it to exit if the ssh fails. Does this require to define a time out for the ssh command so that if the prompt is back before this defined time the next commands are executed??... (2 Replies)
The program asks, whether you want to replace, rename, etc., the file before unzipping. Is there any other command which can unzip the Winzip file in unix or any way so that this message will not come. As i have to run it thru the job scheduler.
Thanks,
Gaurav (1 Reply)