Running q-shell commands( on IBM-i Series) from cygwin terminal (on windows)

I have cygwin installed on windows server and when I do

echo $SHELL the output is

/bin/bash

I have created a ssh tunnel from this windows server through cygwin to ibm -i series which is running Q-shell.

I am trying to invoke a utility wsadmin (used for scripting) on ibm-i from the cygwin terminal and I get the error

wsadmin : syntax error at line 12: '(' unexpected

But when I login through the IBM-i client tool and run the same command it works fine.

How can I run the Q-shell commands (on IBM-I) from cygwin terminal(on windows server) without affecting the current scripts using the /bin/bash on cygwin. Is there a setting I am missing ?

Please show exactly what you have done, word for word, letter for letter, keystroke for keystroke (blanking confidential things, of course.) It's very hard to tell what's not working without seeing this.

I am trying to invoke a scripting utility called wsadmin on ibm-iseries.

Steps below to invoke the scripting client on I-series through IBM-I command line utility

  1. login through the ibm-command line client

  2. Start the QSHELL using the command STRQSH

  3. Navigate to the folder where my scripting utility (wsadmin) is present and ran

  4. wsadmin -lang jython

  5. The output is as below

The java.version property was detected as input. This property is used as out
put only and has no effect on JVM initialization.
WASX7209I: Connected to process "dmgr" on node BoxManager using SOAP connec
tor; The type of process is: DeploymentManager
WASX7031I: For help, enter: "print Help.help()"
wsadmin>

  1. I get the wsadmin prompt successfully which is what I am looking for.

=============================================================================

I wanted to invoke the same utility on the IBM-I series from a windows machine

Now I installed cygwin on a windows machine and set up a ssh tunnel to IBM-I series machine mentioned above ...so I could run the wsadmin utility on IBM-I series from cygwin.

====================================================================================

Verified the ssh tunnel by logging in using the command

ssh user@ibm-i and I was able to login to the IBM-I series machine

======================================================================================
I navigated to the path where wsadmin is present and ran the same command

wsadmin -lang jython and I got the error

wsadmin : syntax error at line 12: '(' unexpected

============================================================================================

My question : Is there some settings that needs to be done to run Q-SHELL COMMANDS on cygwin ?

Thank you, that's very helpful, rules out a lot of problems I'd been wondering about.

Are you logging in with a different user than you usually would? I wonder if it ended up with a different default shell somehow.

Please let me know if my explanation isn't clear.

---------- Post updated at 01:32 PM ---------- Previous update was at 01:28 PM ----------

This is the first time I started the wsadmin utility from cygwin terminal. I verified the user I am logging in with on cygwin terminal has full execute permissions. The shell on IBM-I is QShell but the default on cygwin shows /bin/bash.

Cygwin's user and shell shouldn't matter, once you log into the IBM server.

Cygwin's unusual terminal might cause issues, but I wouldn't expect it to cause that issue -- not recognizing the same script on the same local machine. Obviously the file itself hasn't changed. Maybe the interpreter, the environment, or your user credentials have.

I'm wondering what the difference is between how you log into the IBM server here, and how you would log in otherwise. I don't mean the ssh tunnel -- I mean things like username and credentials on the IBM machine. Things which would affect your profile, envirionment, etc on login.

I don't suppose it'd be as easy as running . /etc/profile first...

Just a clarification so we are on the same page


Attached figure showing the windows 2003 machine and the IBM-i machine.

I use the ibm-client to login to IBM-i and it works

then I use the cygwin terminal to run the same command I get an error

You use the ibm-client to login to IBM-i, but does it login to the same user or not? I don't know what ibm-client is, does it also take you to a shell, or does it take you to that program directly?

Did you try my suggestion of . /etc/profile ?

I am using the same user to login through the IBM-client. When I login through the client I have to enter the command STRQSH (stands for start qshell) to enter into the q-shell and then I can use all the commands.

I am not sure what the /etc/profile solution is.(Really appreciate if you can explain). But here is what I tried.
There was no .profile file initially on the IBM-i under /home/john. So I created one with the below contents .

SHELL="/usr/bin/qsh"
export SHELL
export PATH 

I went back to the windows machine and ran

ssh john@ibm-i 

Ran the set command and I see the SHELL is changed to QShell

SHELL=/usr/bin/qsh

Then I invoked the wsadmin

cd /path/to/wsadmin 

same error:

My ". /etc/profile" solution means typing ". /etc/profile" and hitting the ENTER key once you have logged into the IBM server... This may load a more complete profile in case ssh did not. Have you tried it yet?

But what you are telling me now is very different from what you told me before.

Are you saying you get the error just by running cd /path/to/wsadmin ?

I entered the ./etc/profile on IBM-i and I get

./etc/profile:not found 

I missed the output below. Apologizes.

I mean to say

cd /to/path/to/wsadmin and ran the command

wsadmin -lang jython 

and I got the error

wsadmin : syntax error at line 12: '(' unexpected 

That is not what I asked you to run. You missed a space.

. /etc/profile

Oh ok ..

Entered

. /etc/profile

output

/etc/profile: not found