Script executed. The exit code is 255.

170 views
Skip to first unread message

Nayan Jyoti Gogoi

unread,
Sep 30, 2015, 8:44:43 AM9/30/15
to Jenkins Users
Hi All,

I am executing a shell script using jenkins on a hpux machine.
It goes like this.
------------------------------------------------------
set +e
set +x
#!/bin/sh
        cd /tmp/
        rm -rf bc_env.txt
    echo "SANDBOX:${sandbox}" >> /tmp/bc_env.txt
        echo "SERVER:${aquarius}" >> /tmp/bc_env.txt

echo "############"
cat  /tmp/bc_env.txt
-------------------------------------------------------

It was working fine but now it is showing some error like-

[EnvInject] - Loading node environment variables.
[EnvInject] - Preparing an environment for the build.
[EnvInject] - Keeping Jenkins system variables.
[EnvInject] - Keeping Jenkins build variables.
[EnvInject] - Executing and processing the following script content: 
set -e
set +x
#!/bin/sh
        cd /tmp/
        rm -rf bc_env.txt
	echo "SANDBOX:${sandbox}" >> /tmp/bc_env.txt
        echo "SERVER:${aquarius}" >> /tmp/bc_env.txt

echo "############"
cat  /tmp/bc_env.txt

[wmtst.jenkins] $ /bin/sh -xe /var/tmp/hudson928408455192591691.sh
[EnvInject] - Script executed. The exit code is 255.
[EnvInject] - Fail the build.

And at last the build failed.So is there anyone there to help me.I am confused.


Regards,
Nayan

Maciej Jaros

unread,
Oct 1, 2015, 3:09:03 AM10/1/15
to jenkins...@googlegroups.com
Nayan Jyoti Gogoi (2015-09-30 14:44):
Hi All,

I am executing a shell script using jenkins on a hpux machine.
It goes like this.
------------------------------------------------------
set +e
set +x
#!/bin/sh
        cd /tmp/
        rm -rf bc_env.txt
    echo "SANDBOX:${sandbox}" >> /tmp/bc_env.txt
        echo "SERVER:${aquarius}" >> /tmp/bc_env.txt

echo "############"
cat  /tmp/bc_env.txt
-------------------------------------------------------

Run that script in console and check which part is failing. Using `#!/bin/sh` is kind of weird there. That might be a problem.

Regards,
Nux.

John Mellor

unread,
Oct 1, 2015, 9:31:07 AM10/1/15
to jenkins...@googlegroups.com

Nayan Jyoti Gogoi (2015-09-30 14:44):

Hi All,

I am executing a shell script using jenkins on a hpux machine.
It goes like this.
------------------------------------------------------
set +e
set +x
#!/bin/sh
        cd /tmp/
        rm -rf bc_env.txt
    echo "SANDBOX:${sandbox}" >> /tmp/bc_env.txt
        echo "SERVER:${aquarius}" >> /tmp/bc_env.txt

echo "############"
cat  /tmp/bc_env.txt
-------------------------------------------------------

 

This is an extremely simple script, so the failure has to be too simple to look for    ;^P

Are you out of disk space in /tmp, or have a permission issue for the Jenkins user with /tmp/bc_env.txt ?

 

Put your shebang line as the first line, or it is simply read as a comment.  I’ve used bash in this context before, as /bin/sh is an unknown shell.  For instance on Ubuntu it is /bin/dash instead.  If I remember correctly on HP/UX, /bin/sh is the ancient Bourne shell which probably does not understand what set +e means.

Remove the set +x line.  That is stopping you from seeing the failing line.

Also, a small point:  rm –rf is for recursive delete, which is unnecessary.  Just use rm –f instead.  And maybe fix the indentation mess.

--
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 jenkinsci-use...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/560CDBF1.4030204%40mol.com.pl.
For more options, visit https://groups.google.com/d/optout.

Baptiste Mathus

unread,
Oct 2, 2015, 3:38:25 AM10/2/15
to jenkins...@googlegroups.com

Are you sure it's legal/portable to put things *before* the shebang?

My 2 cents

--
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 jenkinsci-use...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages