Learner
Learner

Reputation: 2339

How to execute command / script file in UNIX using mule?

H,

I am trying to figure out a best way to execute a command / script file in UNIX box using mule.

Can someone confirm if this is a right way to execute command in unix via mule?

<script:component>
<script:script engine="groovy">
def command = "echo hello|/usr/lib/sendmail -v [email protected]"
println "$command"
def cmd = command.execute()
</script:script>
</script:component>

Is there any other way to execute the sh / command files in unix?

Upvotes: 1

Views: 3081

Answers (1)

David Dossot
David Dossot

Reputation: 33413

Using Groovy, as you currently do, is probably the easiest and cleanest approach.

Hopefully in your real application, you won't use a shell script to send emails: Mule has an SMTP endpoint for just doing that :D

Upvotes: 3

Related Questions