# What is the right way to utilize 'system.util.execute' to execute a shell srtipt in Linux?

**URL:** <https://forum.inductiveautomation.com/t/what-is-the-right-way-to-utilize-system-util-execute-to-execute-a-shell-srtipt-in-linux/47541>\
**Category:** Ignition\
**Created:** [June 8, 2021, 5:49am UTC](https://forum.inductiveautomation.com/t/what-is-the-right-way-to-utilize-system-util-execute-to-execute-a-shell-srtipt-in-linux/47541 "2021-06-08T05:49:53Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jay\_L](https://avatars.discourse-cdn.com/v4/letter/j/e9a140/32.png) [@Jay\_L](https://forum.inductiveautomation.com/u/Jay_L)\
**Post date:** [June 8, 2021, 5:49am UTC](https://forum.inductiveautomation.com/t/what-is-the-right-way-to-utilize-system-util-execute-to-execute-a-shell-srtipt-in-linux/47541/1 "2021-06-08T05:49:53Z")

</div>

Hey Guys:  
I have a python file and a shell file which are both executable and their folders are readable in the hierarchy, all of which are created under root user.  
The problem is, I used a messagehandler to pass the command

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/e/0/e07c87dacaba25543b0f7b82eacc1a1a2e8a4174.png)

and I am not able to create a foler through this shell ‘mkdir.sh’  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/f/a/fa6c50e9f8626104bf2caff7802712c8503d7088.png)  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/f/d/fd7805072d6bef58c00d1e89c0bd467abf2e0545.png)  
I can run this shell using command ‘./mkdir.sh’ but when I run "system.util.sendRequest(‘project\_name’, ‘pingCheck’) " in the Script Console, nothing happend.  
It really bothers me cause I really need to be able to run shell command in linux through Ignition.  
Thank you for your incoming help!! Sincerely!!.

---

<div class="post-metadata">

**Author:** ![jespinmartin1](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/jespinmartin1/32/57175_2.png) [@jespinmartin1](https://forum.inductiveautomation.com/u/jespinmartin1)\
**Post date:** [June 8, 2021, 7:48am UTC](https://forum.inductiveautomation.com/t/what-is-the-right-way-to-utilize-system-util-execute-to-execute-a-shell-srtipt-in-linux/47541/2 "2021-06-08T07:48:25Z")

</div>

mmm ones I executed bash with util.execute. Try just by passing

```auto
/home/.../x.sh

```

and not include “bin/bash”

I would recommend to avoid this approach if you want to ping an ip, read this reference [InetAddress (Java Platform SE 7 ) (oracle.com)](https://docs.oracle.com/javase/7/docs/api/java/net/InetAddress.html)

---

<div class="post-metadata">

**Author:** ![Jay\_L](https://avatars.discourse-cdn.com/v4/letter/j/e9a140/32.png) [@Jay\_L](https://forum.inductiveautomation.com/u/Jay_L)\
**Post date:** [June 8, 2021, 8:07am UTC](https://forum.inductiveautomation.com/t/what-is-the-right-way-to-utilize-system-util-execute-to-execute-a-shell-srtipt-in-linux/47541/3 "2021-06-08T08:07:49Z")

</div>

Yes you are amazing, I do wanna ping an ip through this way 😂 😂 😂 And I am sorry but I dont get your reference.

I tried just pass ‘/home/…/x.sh’ but there is still no signal that the shell script is executed.

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/8/4/84c49d662cd51e82929f6d7dc6d55e2009e7dc0e.png)  
Also, I tried to delete a file using ‘rm -rf’ and it worked which makes more confused that what on earth is wrong with the shell.

---

<div class="post-metadata">

**Author:** ![jespinmartin1](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/jespinmartin1/32/57175_2.png) [@jespinmartin1](https://forum.inductiveautomation.com/u/jespinmartin1)\
**Post date:** [June 8, 2021, 8:36am UTC](https://forum.inductiveautomation.com/t/what-is-the-right-way-to-utilize-system-util-execute-to-execute-a-shell-srtipt-in-linux/47541/4 "2021-06-08T08:36:25Z")

</div>

You may place this where ever you need but there’s a example in a button:

![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/1/1/11dc47c97dc794b1857752bba29d27d5facc1162.png)

script:

```auto
from java.net import InetAddress
timeout = 300
ipAddress = '10.0.30.1'
ipInet = InetAddress.getByName(ipAddress)
reachable = ipInet.isReachable(timeout)
if reachable:
	print 'woh, successfully ping to '+ipAddress
else:
	print ":´( ping to "+ipAddress+' failed in '+str(timeout)+'ms'

```

---

<div class="post-metadata">

**Author:** ![Jay\_L](https://avatars.discourse-cdn.com/v4/letter/j/e9a140/32.png) [@Jay\_L](https://forum.inductiveautomation.com/u/Jay_L)\
**Post date:** [June 8, 2021, 9:05am UTC](https://forum.inductiveautomation.com/t/what-is-the-right-way-to-utilize-system-util-execute-to-execute-a-shell-srtipt-in-linux/47541/5 "2021-06-08T09:05:50Z")

</div>

Thank you my friend.

Now I can ping an ip using your method. I really appreciate your help!! Thank you a lot!!!

On the other hand, I think I still need my gateway to execute some linux command some day in the future. So it is important for me to figure out how to control the ‘system.util.execute’ to run a python script or a shell script. 🙏 🙏 🙏 🙏
