web stats
How to execute linux commands - Mirth Community

Go Back   Mirth Community > Mirth Connect > Support

Reply
 
Thread Tools Display Modes
  #1  
Old 09-26-2016, 06:36 AM
mpa mpa is offline
What's HL7?
 
Join Date: Sep 2016
Posts: 2
mpa is on a distinguished road
Question How to execute linux commands

Hi all,

I'm new to Mirth Connect and my first impression - it is a very powerful integration engine and provides a lot of integrated solutions, but I have some problems with decode (later also encode) zip Files. I have found some threads (http://www.mirthproject.org/communit...ead.php?t=3909) but they don't really help me. I need some solution where I can work with scripting or at least I can execute Linux Command like (for example unzip with 7zip). Please, help me to find some solution.

Best regards

mpa

Last edited by mpa; 09-26-2016 at 07:12 AM.
Reply With Quote
  #2  
Old 09-26-2016, 08:18 AM
siddharth siddharth is offline
Mirth Guru
 
Join Date: Feb 2013
Posts: 832
siddharth is on a distinguished road
Default

If your problem is zipping/Unzipping a file, you can do through Java script. The code is in the link you have.

If your problem is executing a windows command through Mirth, that can be done but will be very tedious to achieve, through this

java.lang.Runtime.getRuntime().exec("system_comman d");

But there will be lot of modifications you need to make in it.
Reply With Quote
  #3  
Old 09-30-2016, 04:00 AM
mpa mpa is offline
What's HL7?
 
Join Date: Sep 2016
Posts: 2
mpa is on a distinguished road
Default

Hi siddharth,

the code from the link above doesn't work for me, probably I do something wrong...

Sooner or later I will need the possibility to execute shell scripts and other cli's commands. It would be helpful and nice from you if you could help me a little bit on this way.

Sorry for my english!

Best regards

mpa
Reply With Quote
  #4  
Old 10-11-2016, 04:33 AM
robrud robrud is offline
Mirth Newb
 
Join Date: Oct 2015
Posts: 12
robrud is on a distinguished road
Default Shell Scripts

Hi,

Here my codesnippet from a Source-Transformer calculating the MD5-Sum on a Ubuntu OS. Mirth 3.3.2. If you search the Forum for getRuntime.exec you'll find a lot of other examples for executing shell commands.

Code:
var md5p = java.lang.Runtime.getRuntime().exec('md5sum /.../' + sourceMap.get('originalFilename'));
md5p.waitFor();
var md5is = md5p.getInputStream();
var md5content = org.apache.commons.io.IOUtils.toString(md5is);
Reply With Quote
Reply

Tags
command line, java, javascript, linux, shell

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -8. The time now is 03:16 PM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2019, vBulletin Solutions, Inc.
Mirth Corporation