Reputation: 2339
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
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