# System.util.execute() not working in Linux: how do I run external shell script from Ignition?

**URL:** <https://forum.inductiveautomation.com/t/system-util-execute-not-working-in-linux-how-do-i-run-external-shell-script-from-ignition/14430>\
**Category:** Ignition\
**Tags:** ignition79, scripting\
**Created:** [May 31, 2017, 4:36pm UTC](https://forum.inductiveautomation.com/t/system-util-execute-not-working-in-linux-how-do-i-run-external-shell-script-from-ignition/14430 "2017-05-31T16:36:24Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Denis.Ulybyshev](https://avatars.discourse-cdn.com/v4/letter/d/c6cbf5/32.png) [@Denis.Ulybyshev](https://forum.inductiveautomation.com/u/Denis.Ulybyshev)\
**Post date:** [May 31, 2017, 4:36pm UTC](https://forum.inductiveautomation.com/t/system-util-execute-not-working-in-linux-how-do-i-run-external-shell-script-from-ignition/14430/1 "2017-05-31T16:36:24Z")

</div>

Hello, All,  
I am trying to call external shell script from Ignition running under Linux with using system.util.execute() command and still did not succeed. At the same time, calling bat-script under Windows works fine with using the following command  
system.util.execute([“C:\windows\system32\cmd.exe”,"/C",“start”,“C:\<path\_to\_script\>\test.bat”])

Example at [https://support.inductiveautomation.com/usermanuals/ignition/index.html?system\_util\_execute.htm](https://support.inductiveautomation.com/usermanuals/ignition/index.html?system_util_execute.htm) is for Windows, but there is not example for Linux. I tried system.util.execute(["/bin/sh"]), system.util.execute(["/bin/sh", “ls”, “-la”]), system.util.execute(["/bin/bash", “ls”]), system.util.execute(["/bin/sh", \<path\_to\_my\_script\>]) but no success.  
I would really appreciate any help on that

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [May 31, 2017, 4:53pm UTC](https://forum.inductiveautomation.com/t/system-util-execute-not-working-in-linux-how-do-i-run-external-shell-script-from-ignition/14430/2 "2017-05-31T16:53:58Z")

</div>

How are you evaluating whether those commands executed successfully or not? Is there an IOException being thrown or does `system.util.execute` invoke without error?

---

<div class="post-metadata">

**Author:** ![Denis.Ulybyshev](https://avatars.discourse-cdn.com/v4/letter/d/c6cbf5/32.png) [@Denis.Ulybyshev](https://forum.inductiveautomation.com/u/Denis.Ulybyshev)\
**Post date:** [May 31, 2017, 5:51pm UTC](https://forum.inductiveautomation.com/t/system-util-execute-not-working-in-linux-how-do-i-run-external-shell-script-from-ignition/14430/3 "2017-05-31T17:51:37Z")

</div>

Hello, Kevin,  
Thanks for responding. There is no IO exception, just my command **system.util.execute([])** is not executed. IO exception raises when there is an error on the path to my script, for example. When I run the following command in Windows:  
**system.util.execute([“C:\windows\system32\cmd.exe”,"/C",“start”,“C:\path\_to\_myscript\test.bat”])**

it works fine - terminal window shows up and my script test.bat is executed. I am looking for some example how to do the same thing in Ignition under Linux.  
P.S. Based on other related topic from this forum, I also tried to run  
**system.util.execute([“sh”, “/home/path\_to\_myscript.sh”, “shell=True”])** and **system.util.execute([“sh”, “/home/path\_to\_myscript.sh”])** - still no success, nothing happens, no error, script is not executed

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [May 31, 2017, 5:56pm UTC](https://forum.inductiveautomation.com/t/system-util-execute-not-working-in-linux-how-do-i-run-external-shell-script-from-ignition/14430/4 "2017-05-31T17:56:06Z")

</div>

I don’t think you can expect a terminal to show up on Linux by executing/invoking `bash`. Your shell doesn’t have a GUI. You need to try to open a terminal emulator like `xterm` or something.

---

<div class="post-metadata">

**Author:** ![Denis.Ulybyshev](https://avatars.discourse-cdn.com/v4/letter/d/c6cbf5/32.png) [@Denis.Ulybyshev](https://forum.inductiveautomation.com/u/Denis.Ulybyshev)\
**Post date:** [May 31, 2017, 5:57pm UTC](https://forum.inductiveautomation.com/t/system-util-execute-not-working-in-linux-how-do-i-run-external-shell-script-from-ignition/14430/5 "2017-05-31T17:57:46Z")

</div>

OK, but can I expect my shell script to be executed?

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [May 31, 2017, 5:58pm UTC](https://forum.inductiveautomation.com/t/system-util-execute-not-working-in-linux-how-do-i-run-external-shell-script-from-ignition/14430/6 "2017-05-31T17:58:14Z")

</div>

Yes, but don’t expect to see anything.

---

<div class="post-metadata">

**Author:** ![Denis.Ulybyshev](https://avatars.discourse-cdn.com/v4/letter/d/c6cbf5/32.png) [@Denis.Ulybyshev](https://forum.inductiveautomation.com/u/Denis.Ulybyshev)\
**Post date:** [May 31, 2017, 6:33pm UTC](https://forum.inductiveautomation.com/t/system-util-execute-not-working-in-linux-how-do-i-run-external-shell-script-from-ignition/14430/7 "2017-05-31T18:33:16Z")

</div>

Thank you, Kevin. There was an error in my shell script. I fixed it and now the script is executed fine!

---

<div class="post-metadata">

**Author:** ![sroyrohit](https://avatars.discourse-cdn.com/v4/letter/s/85f322/32.png) [@sroyrohit](https://forum.inductiveautomation.com/u/sroyrohit)\
**Post date:** [January 13, 2024, 9:17pm UTC](https://forum.inductiveautomation.com/t/system-util-execute-not-working-in-linux-how-do-i-run-external-shell-script-from-ignition/14430/8 "2024-01-13T21:17:01Z")

</div>

I followed the exact process. I am not getting only success in status but the script is not executing... I tried all the ways you suggested. My shell script worked when ran in terminal, but ignition is not able to run it. Also I gave a file that does not exist to see if I get error from the gateway script. Still I get success and no indication of file not found error. I urgently need help.  
My gateway script looks like this:  
`system.util.execute(["sh","/home/ubuntu/pilotCall.sh"])`

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [January 14, 2024, 1:08am UTC](https://forum.inductiveautomation.com/t/system-util-execute-not-working-in-linux-how-do-i-run-external-shell-script-from-ignition/14430/9 "2024-01-14T01:08:31Z")

</div>

`system.util.execute()` never returns any status. It is a completely blind, unaimed, "fire-and-forget" ~~weapon~~ _tool_.

Use java's `ProcessBuilder` to run your script, with reading of the process' `stdout` and `stderr` streams to see what is happening.
