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

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 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

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?

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

1 Like

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.

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

Yes, but don’t expect to see anything.

1 Like

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