Prevent Jenkins from deleting temp shell script for job

1,808 views
Skip to first unread message

Nick Dierauf

unread,
Sep 12, 2014, 5:05:17 PM9/12/14
to jenkins...@googlegroups.com
Hello,

I am getting the following error while attempting to execute my Jenkins (v 1.577) job:

[workspace] $ /home/administrator/Hudson/instances/Albatross/tomcat-8092-8022/temp/hudson8884100134029098059.js
FATAL: command execution failed
java.io.IOException: Cannot run program "/home/administrator/Hudson/instances/Albatross/tomcat-8092-8022/temp/hudson8884100134029098059.js" (in directory "/home/administrator/Hudson/instances/Albatross/.hudson/jobs/aMart/workspace"): java.io.IOException: error=13, Permission denied

Apparently Jenkins creates this temporary file and contains instructions about executing the job. I would like to inspect the contents of this file however it seems that Jenkins immediately removes this file upon completion of the job. Is there any way to prevent Jenkins from deleting this temp file?

I've searched around the forums but did not find an answer.

Thank you,
Nick.

Nick Dierauf

unread,
Oct 2, 2014, 5:50:50 PM10/2/14
to jenkins...@googlegroups.com
Would love to get some insight into this temporary file that Jenkins creates. Anybody care to respond? Thanks!

--
You received this message because you are subscribed to a topic in the Google Groups "Jenkins Users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/jenkinsci-users/atVAd6MQ_rs/unsubscribe.
To unsubscribe from this group and all its topics, send an email to jenkinsci-use...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Daniel Serodio

unread,
Oct 21, 2014, 9:27:48 AM10/21/14
to jenkins...@googlegroups.com
If this is a freestyle job, you could add "set -x" before the first build step and it'll output all executed shell commands.

Regards,
Daniel Serodio

Nick Dierauf

unread,
Oct 27, 2014, 12:41:25 AM10/27/14
to jenkins...@googlegroups.com
Thanks Daniel.
Nick.

Ohad Schneider

unread,
Apr 20, 2016, 8:56:40 AM4/20/16
to Jenkins Users
set -x is the default but it's not ideal.
When you have pipes and redirections it's hard to tell what's going on.

A better solution would be to do something like
cp $BASH_SOURCE /tmp/Jenkins/scripts

To copy the currently executing script to some folder of your choosing (you could use mktemp but I think the name is unique anyway)
Reply all
Reply to author
Forward
0 new messages