cancel
Showing results for 
Search instead for 
Did you mean: 

Running shell script from Activiti

pintu_2016
Champ in-the-making
Champ in-the-making
Hi,

We are planning to use activiti for workflow management. As part of this mostly we will execute shell scripts from activiti.
Can I directly call shell scripts from activiti using shell task (without java class)?
And what are the other workaround to execute shell.

Regards
3 REPLIES 3

jbarrez
Star Contributor
Star Contributor
Yes, there is an OOTB shell task: http://activiti.org/userguide/index.html#bpmnShellTask

pintu_2016
Champ in-the-making
Champ in-the-making
Hi,

Thanks for your quick reply.
Tried to create a very simple process, While deploying the bpmn file via activiti explorere got below error.

"Create of BPMN XML failed
Errors while parsing:[Validation set:'activiti-execute-process'|Problem:'activiti-servicetask-missing-implementation']: etc…"


Please let me know if I am missing something.

PFB the code of bpmn file.

<code>
<?xml version="1.0" encoding="UTF-8"?>
<definitions xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:activiti="http://activiti.org/bpmn" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlnsSmiley Surprisedmgdc="http://www.omg.org/spec/DD/20100524/DC" xmlnsSmiley Surprisedmgdi="http://www.omg.org/spec/DD/20100524/DI" typeLanguage="http://www.w3.org/2001/XMLSchema" expressionLanguage="http://www.w3.org/1999/XPath" targetNamespace="http://www.activiti.org/test">
  <process id="myProcess" name="My process" isExecutable="true">
    <startEvent id="startevent1" name="Start"></startEvent>
    <sequenceFlow id="flow1" sourceRef="startevent1" targetRef="servicetask1"></sequenceFlow>
    <endEvent id="endevent2" name="End"></endEvent>
    <sequenceFlow id="flow2" sourceRef="servicetask1" targetRef="endevent2"></sequenceFlow>
    <serviceTask id="servicetask1" name="User Task" activiti:type="shell">
    <extensionElements>
    <activiti:field name="command" stringValue="cmd" />
    <activiti:field name="arg1" stringValue="./test.sh" />
  </extensionElements>
    </serviceTask>
  </process>
  <bpmndi:BPMNDiagram id="BPMNDiagram_myProcess">
    <bpmndi:BPMNPlane bpmnElement="myProcess" id="BPMNPlane_myProcess">
      <bpmndi:BPMNShape bpmnElement="startevent1" id="BPMNShape_startevent1">
        <omgdc:Bounds height="37.0" width="36.0" x="100.0" y="156.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="endevent2" id="BPMNShape_endevent2">
        <omgdc:Bounds height="35.0" width="35.0" x="550.0" y="157.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="servicetask1" id="BPMNShape_servicetask1">
        <omgdc:Bounds height="55.0" width="105.0" x="290.0" y="147.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNEdge bpmnElement="flow1" id="BPMNEdge_flow1">
        <omgdi:waypoint x="136.0" y="174.0"></omgdi:waypoint>
        <omgdi:waypoint x="290.0" y="174.0"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="flow2" id="BPMNEdge_flow2">
        <omgdi:waypoint x="395.0" y="174.0"></omgdi:waypoint>
        <omgdi:waypoint x="550.0" y="174.0"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
    </bpmndi:BPMNPlane>
  </bpmndi:BPMNDiagram>
</definitions>
<code>

martin_grofcik
Confirmed Champ
Confirmed Champ
Hi,

Working example is org.activiti.examples.bpmn.shell.ShellTaskTest.

regards
Martin