|
#1
|
|||
|
|||
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: [00mtotal 10 drwxr-xr-x 2 ic users 112 2011-04-18 04:23 [01;34m.[00m drwxr-xr-x 37 ic users 1800 2011-04-18 04:23 [01;34m..[00m -rwxr-xr-x 1 ic users 729 2011-04-14 04:19 [00;32msource_file_backup.sh[00m -rwxr-xr-x 1 ic users 20 2011-04-18 04:23 [00;32mtest.sh[00m [mic@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. |
#2
|
|||
|
|||
What happens if you execute the script manually from a SSH client?
|
#3
|
|||
|
|||
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. |
#4
|
|||
|
|||
Try adding a 3rd line to the script for the server response, i.e.
ic@ServerDev11:~> bash ~/bin/source_file_backup.sh ic@ServerDev11:~> |
#5
|
|||
|
|||
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? |
#6
|
|||
|
|||
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.
|
#7
|
|||
|
|||
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. |
|
|