cancel
Showing results for 
Search instead for 
Did you mean: 

Running shell script from Activiti

alexbt
Champ in-the-making
Champ in-the-making
What is the best way to run a ksh or bash script (instead of a Java class) from within a script task?
Or the only way is to wrap it with a Java class and use ProcessBuilder to run ksh/bash script?
Maybe it's better to use Groovy to start ksh/bash script?
Any ideas?

One more question. Can I use jython instead of Groovy as a script implementation?

Thanks in advance,
Alex
13 REPLIES 13

jbarrez
Star Contributor
Star Contributor
Alex,

You can use any JSR-223 compliant language. So if JYthon supports that spec, just add it to the classpath and change the 'scriptFormat' value.

I don't have a best practice on how to start a shell script, so I dont see any other solution than doing as you say.

alexbt
Champ in-the-making
Champ in-the-making
Thanks for your quick reply.

Alex

tombaeyens
Champ in-the-making
Champ in-the-making
I think starting a command line process is a great idea for an activity type.  Created http://jira.codehaus.org/browse/ACT-461 so that we don't forget about this idea

alexbt
Champ in-the-making
Champ in-the-making
Yes, I totally agree with it. This is actually my case - to start a ksh  (on HP-UX or AIX servers) and bash (on Linux ones) scripts.

Alex

alexbt
Champ in-the-making
Champ in-the-making
I also have 2 ideas for UI part of the system.
Where should I post them?

Regards,
Alex

jbarrez
Star Contributor
Star Contributor
Depends on what you mean with 'ui'. We have separate forums for each Activiti component now, see http://forums.activiti.org/en/index.php

ronald_van_kuij
Champ on-the-rise
Champ on-the-rise
We started working on this one… An important question is how the parameters to commands should be passed on. (java exec does not match to os level)
We could do two things. String parsing of a full command and params. Or a separte command field and one or more param fields.
If we go for the former, I propose to use something like
- a space is a separator between params
- " or ' around something means it may contain spaces
- \ before a space means it should be treated as part of a parameter

Some other questions:
- do we need the ability to set environment properties?
- do we do someting with the return value?
- do we do something with the output of the command (if at stdout)

jbarrez
Star Contributor
Star Contributor
Ronald, could you give some examples of how the xml would look like?

I think capturing the return result is valid, as it allows to check on success or failure.
Capturing the output doesnt seem very important to me.

smirzai
Champ on-the-rise
Champ on-the-rise
what happened to this topic  ? Is it implemented, forgotten or impossible ?