Kinook Software Forum

Go Back   Kinook Software Forum > Visual Build Professional > [VBP] General Discussion
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Rate Thread Display Modes
  #1  
Old 04-18-2011, 10:10 AM
bwilder bwilder is online now
Registered User
 
Join Date: 02-23-2011
Posts: 17
Problems kicking off shell script through Telnet step

Hi,
I've got a telnet step set up to kick off a shell script on a remote Suse Linux server. When I run the step, it connects as expected and returns a success message, but then when I check the server to make sure the action was completed, I find no change.

For example:
test.sh -
mkdir ~/bin/my_test

After running the script local to the server, I get a new directory ~/bin/my_test. After running the script through the telnet step (with the same credentials), I get:
Telnet Script tab -
ic@Server111:~>
bash ~/bin/test.sh

Build log results -
4/18/2011 10:50:59 AM: --------------------Starting Build: 'gamearchive_TEST.bld'--------------------
4/18/2011 10:50:59 AM: Building project step 3 - Test Step...
Connecting to SSH server '10.1.xxx.111' on port 22
Host key fingerprint: e0:e4:07:b4:29:64:fb:7e:4e:41:c1:e3:7e:f6:36:4c

<= Received from server:
Last login: Mon Apr 18 04:47:28 2011 from 10.1.xxx.21
ic@ServerDev11:~>

=> Sending to server:
bash ~/bin/test.sh
Script successfully executed
4/18/2011 10:51:01 AM: Build successfully completed.

Upon checking for the new dir, I find nothing. I've also tried running a slightly modified version of the ssh.bld from in another post about ssh issues and got similar results:

Telnet Script tab -
ic@Server111:~>
ls -al ~/bin
ic@Server111:~>
echo test > ~/bin/xyz.txt

Build Log results -
4/18/2011 10:59:32 AM: --------------------Starting Build: 'gamearchive_TEST.bld'--------------------
4/18/2011 10:59:32 AM: Building project step 3 - Test Step...
Connecting to SSH server '10.1.xxx.111' on port 22
Host key fingerprint: e0:e4:07:b4:29:64:fb:7e:4e:41:c1:e3:7e:f6:36:4c

<= Received from server:
Last login: Mon Apr 18 04:52:55 2011 from 10.1.xxx.21
ic@ServerDev11:~>

=> Sending to server:
ls -al ~/bin

<= Received from server:
total 10
drwxr-xr-x 2 ic users 112 2011-04-18 04:23 .
drwxr-xr-x 37 ic users 1800 2011-04-18 04:23 ..
-rwxr-xr-x 1 ic users 729 2011-04-14 04:19 source_file_backup.sh
-rwxr-xr-x 1 ic users 20 2011-04-18 04:23 test.sh
ic@Server111:~>

=> Sending to server:
echo test > ~/bin/xyz.txt
Script successfully executed
4/18/2011 10:59:36 AM: Build successfully completed.

As you can see, the "ls -al ~/bin" seems to work as expected, but the "echo test > ~/bin/xyz.txt" does nothing at all. If I check ~/bin/ on my server, there is no xyz.txt. To me, this would indicate a permissions issue, but I've got the telnet step configured with the same permissions that I use to run the test script locally. Any other thoughts?

BTW, the files requested in http://www.kinook.com/Forum/showthre...?threadid=3044 have been emailed to support@kinook.com with the name TelnetStepFiles.zip.
Reply With Quote
  #2  
Old 04-18-2011, 10:41 AM
kinook kinook is online now
Administrator
 
Join Date: 03-06-2001
Location: Colorado
Posts: 6,034
What happens if you execute the script manually from a SSH client?
Reply With Quote
  #3  
Old 04-18-2011, 12:51 PM
bwilder bwilder is online now
Registered User
 
Join Date: 02-23-2011
Posts: 17
If I execute my test.sh script manually, a new directory named my_test is created in ~/bin (as expected). If I execute "echo test > ~/bin/xyz.txt" manually, a new file with the word "test" is created in ~/bin/xyz.txt (also as expected).

If I execute my test.sh script via the telnet step in Visual Build, VB reports the script completed successfully, but there is no directory on the host. If I run "echo test > ~/bin/xyz.txt" vi the telnet step in VB, again the app tells me the step completed successfully, but there is no ~/bin/xyz.txt on the host.
Reply With Quote
  #4  
Old 04-18-2011, 02:20 PM
kinook kinook is online now
Administrator
 
Join Date: 03-06-2001
Location: Colorado
Posts: 6,034
Try adding a 3rd line to the script for the server response, i.e.

ic@ServerDev11:~>
bash ~/bin/source_file_backup.sh
ic@ServerDev11:~>
Reply With Quote
  #5  
Old 04-20-2011, 10:39 AM
bwilder bwilder is online now
Registered User
 
Join Date: 02-23-2011
Posts: 17
Adding the 3rd line helped, thanks!

So the script in my step looks like:
ic@ServerDev11:~>
bash ~/bin/source_file_backup.sh
ic@ServerDev11:~>

The shell script I'm calling remotely mainly creates a tar of a specific directory, which can take a variable length of time depending on what gets put in the directory being tar'd by the build process.

Is there any way to make the step just wait for any response from the server without upping the Delay on the Script tab to some ungodly amount like 120000 milliseconds?
Reply With Quote
  #6  
Old 04-20-2011, 08:08 PM
kinook kinook is online now
Administrator
 
Join Date: 03-06-2001
Location: Colorado
Posts: 6,034
The ic@ServerDev11:~> response shouldn't occur until the script finishes, but you may need to use a large delay value if the script could run for a long time (the step does need to wait for the script to actually finish in order for it to complete). You could also echo some unique string at the end of the script and wait for that instead. The step shouldn't wait the entire delay amount if the the script completes and the specified response is found.
Reply With Quote
  #7  
Old 04-21-2011, 07:44 AM
bwilder bwilder is online now
Registered User
 
Join Date: 02-23-2011
Posts: 17
The remote host doesn't respond until the script finishes, which is the problem. The step times out locally when the value set in the timeout field is met, regardless of whether or not the actual process is complete.

For the sake of completeness, if the duration is set to some high value, the step will complete as expected when it receives a response if the response comes before the duration is met.
Reply With Quote
Reply


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



All times are GMT -5. The time now is 11:07 PM.


Copyright © 1999-2023 Kinook Software, Inc.