# Execute Linux command and get result in Ignition script

**URL:** <https://forum.inductiveautomation.com/t/execute-linux-command-and-get-result-in-ignition-script/30192>\
**Category:** Ignition\
**Created:** [November 23, 2019, 1:06pm UTC](https://forum.inductiveautomation.com/t/execute-linux-command-and-get-result-in-ignition-script/30192 "2019-11-23T13:06:03Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![nader.chinichian](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nader.chinichian/32/9261_2.png) [@nader.chinichian](https://forum.inductiveautomation.com/u/nader.chinichian)\
**Post date:** [November 23, 2019, 1:06pm UTC](https://forum.inductiveautomation.com/t/execute-linux-command-and-get-result-in-ignition-script/30192/1 "2019-11-23T13:06:03Z")

</div>

Hello

I want to get some info of my raspberry PI like CPU temp, speed,… directly in Ignition.  
Running some basic OS command will return the result but the problem is **system.util.execute** function doesn’t return any value. So I wonder how can I do that directly in ignition?  
Right now I use node red which it run command and parse the data and send the trimmed data to ignition via OPC UA which is not optimize in tiny device like RPi with limited 1GB RAM.  
Also I try python gpiozero, but it doesn’t work either.

---

<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:** [November 23, 2019, 2:16pm UTC](https://forum.inductiveautomation.com/t/execute-linux-command-and-get-result-in-ignition-script/30192/2 "2019-11-23T14:16:10Z")

</div>

Either Python’s [subprocess API](https://docs.python.org/2/library/subprocess.html) or Java’s [Process API](https://docs.oracle.com/javase/8/docs/api/java/lang/Process.html) should work.

---

<div class="post-metadata">

**Author:** ![nader.chinichian](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nader.chinichian/32/9261_2.png) [@nader.chinichian](https://forum.inductiveautomation.com/u/nader.chinichian)\
**Post date:** [November 23, 2019, 2:47pm UTC](https://forum.inductiveautomation.com/t/execute-linux-command-and-get-result-in-ignition-script/30192/3 "2019-11-23T14:47:26Z")

</div>

Hi Kevin  
Could please write simple example to show in detail of doing this in ignition.

I try this in button script but get following error:

```auto
import os
from gpiozero import CPUTemperature

cpu = CPUTemperature()
print(cpu.temperature)

```

> Traceback (most recent call last):  
> File "event:actionPerformed", line 2, in   
> File "C:\Users\Nader.ignition\cache\gwlocalhost\_8088\C0\pylib\gpiozero\__init_\_.py", line 97, in   
> from .output\_devices import (  
> File "C:\Users\Nader.ignition\cache\gwlocalhost\_8088\C0\pylib\gpiozero\output\_devices.py", line 45, in   
> from colorzero import Color  
> ImportError: No module named colorzero

---

<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:** [November 23, 2019, 2:59pm UTC](https://forum.inductiveautomation.com/t/execute-linux-command-and-get-result-in-ignition-script/30192/4 "2019-11-23T14:59:55Z")

</div>

I don’t know what that library is or what it’s doing. You asked for an alternative to `system.util.execute` because you aren’t able to see the output of commands you run, so I’m not sure how this is relevant.

---

<div class="post-metadata">

**Author:** ![nader.chinichian](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nader.chinichian/32/9261_2.png) [@nader.chinichian](https://forum.inductiveautomation.com/u/nader.chinichian)\
**Post date:** [November 23, 2019, 3:21pm UTC](https://forum.inductiveautomation.com/t/execute-linux-command-and-get-result-in-ignition-script/30192/5 "2019-11-23T15:21:17Z")

</div>

> [@Kevin.Herron](#):
>
> you

Sorry it's not directly relevant, I'm just using the topic about interaction Rpi and alternative solution.  
about Python’s [subprocess API] could you send me a simple example to show how to get the result of "free -h" or "vcgencmd measure\_temp" command?
