Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

How to execute shell script with parameters in postfunction using ScriptRunner

Tammy Robinson
Contributor
May 29, 2019

When my request is submitted, I need to execute a script and pass parameters from my  request. Are there any examples on how to achieve this? I created a test and added this line into my workflow postfunction, but nothing happens. Can someone please provide insight on how to do this using ScriptRunner?

 

"ssh myid@myjiraserver.com test.sh".execute()

2 answers

0 votes
DH
Contributor
July 5, 2022

Hi @Tammy Robinson , this works in the Scriptrunner console. Maybe this can work in your post-function also?



def command = 'ls -al' 
def proc = command.execute()
proc.waitFor()
log.warn "Process exit code: ${proc.exitValue()}"
log.warn "Std Err: ${proc.err.text}"
log.warn "Std Out: ${proc.in.text}"
0 votes
Alexey Matveev
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 29, 2019

Hello,

You would need an app for it. For example, Power Scripts, ScriptRunner, MyGroovy, Groovioli and so on.

If you want to use the Power Scripts app, then you should execute the system routine:

https://confluence.cprime.io/display/SIL/system

Tammy Robinson
Contributor
May 29, 2019

Hi Alexey,

Thank you for replying. Sorry I forgot to mention that I am trying to execute this in ScriptRunner.

Tammy Robinson
Contributor
May 29, 2019

Any ideas on how to do this using ScriptRunner?

Suggest an answer

Log in or Sign up to answer