On Thu, Oct 10, 2013 at 7:51 AM, Ranjith P <[email protected]> wrote:
> I have written a shell command to copy the build artifacts to a server in

That's an expect script, not a shell script...

> Post build action.
>
> Script:
> ---------
>
> #!/usr/bin/expect -f
> #!usr/bin/expect
> set pass "password"
> spawn scp -r ${WORKSPACE}/my_project/target/*.jar
> [email protected]:/usr/local/jars
> expect "*Password:*"
> send "${pass}\r";
> expect eof
>
> Its not working as expected and showing exception as
>
> /usr/local/itag/apache-tomcat-7.0.14/temp/hudson5412037345746046257.sh: line
> 4: spawn: command not found

That means the shell is executing it, not expect.  However Jenkins
starts shell scripts must be explicitly running /bin/sh or bash,
probably with some extra command line options instead of parsing the
#!interpreter line.

> If I run the same script through a terminal, it will work.

But probably not if you type:
sh scriptname

> Please help me to resolve this.

The simple way is to have an actual shell script that executes your
expect script.  But using ssh keys instead of a password would avoid
the issue and also avoid have the password in a plain text file.

-- 
   Les Mikesell
     [email protected]

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to