I want to executing a shell script in the post functions and the output obtained from it should be stored in a Text Type custom field.
I have tried using the below script but it did not work. Kindly suggest.
def sout = new StringBuffer(), serr = new StringBuffer()
def proc = 'sh /jira/test.sh'.execute ()
proc.consumeProcessOutput(sout,serr)
String fileContents = new File('jira/out.txt').getText('UTF-8')
return fileContents
Hi,
I have been using this snippet to execute sh scripts :
def shCommand = "sh /jira/test.sh"
return = Runtime.getRuntime().exec(shCommand);
int exitCode = return.waitFor()
Let me know how that went.
Antoine
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.