<?xml version="1.0" encoding="utf-8"?>
<feed xml:lang="en" xmlns="http://www.w3.org/2005/Atom"><title>Recent posts to Sys Process Execute Command</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/64904fac37/" rel="alternate"/><link href="https://forge.codesys.com/forge/talk/Engineering/thread/64904fac37/feed.atom" rel="self"/><id>https://forge.codesys.com/forge/talk/Engineering/thread/64904fac37/</id><updated>2023-11-17T11:28:42.694000Z</updated><subtitle>Recent posts to Sys Process Execute Command</subtitle><entry><title>Sys Process Execute Command</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/64904fac37/?limit=25#30d0" rel="alternate"/><published>2023-11-17T11:28:42.694000Z</published><updated>2023-11-17T11:28:42.694000Z</updated><author><name>fabian</name><uri>https://forge.codesys.com/u/fabian/</uri></author><id>https://forge.codesys.comdf07404f2588bfdb5b6383e0787578784a64171d</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;I have a question:&lt;br/&gt;
Once the command is being executed, is there a way to kill it again?&lt;br/&gt;
As the called application is running in the background, the user can't close it but it shall be closed/terminated, commanded by codesys.&lt;/p&gt;
&lt;p&gt;I have tried with "SysProcessTerminate" but I guess this is not correct as the RTE crashes when this function is called.&lt;/p&gt;
&lt;p&gt;Starting the application:&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="nt"&gt;IF&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;GVL&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;xStrtQR&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;THEN&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="nt"&gt;GVL&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;xStrtQR&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;:=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;FALSE&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="nt"&gt;SysProcess&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;SysProcessExecuteCommand2&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nt"&gt;pszCommand&lt;/span&gt;&lt;span class="o"&gt;:=&lt;/span&gt;&lt;span class="nt"&gt;sCmd&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;pszStdOut&lt;/span&gt;&lt;span class="o"&gt;:=&lt;/span&gt;&lt;span class="nt"&gt;stdout&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;udiStdOutLen&lt;/span&gt;&lt;span class="o"&gt;:=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;SIZEOF&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nt"&gt;stdout&lt;/span&gt;&lt;span class="o"&gt;),&lt;/span&gt;&lt;span class="nt"&gt;pResult&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;:=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;ADR&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nt"&gt;GVL&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;pResQRTsk&lt;/span&gt;&lt;span class="o"&gt;));&lt;/span&gt;
&lt;span class="nt"&gt;END_IF&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Trying to stop it again:&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="nt"&gt;IF&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;GVL&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;xTrmQR&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;THEN&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="nt"&gt;GVL&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;xTrmQR&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;:=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;FALSE&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;

&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="nt"&gt;pResTerm&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;:=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;SysProcess&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;SysProcessTerminate&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nt"&gt;hProcess&lt;/span&gt;&lt;span class="o"&gt;:=&lt;/span&gt;&lt;span class="nt"&gt;SysProcess&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;SysProcessGetCurrentHandle&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nt"&gt;pResult&lt;/span&gt;&lt;span class="o"&gt;:=&lt;/span&gt;&lt;span class="nt"&gt;ADR&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nt"&gt;GVL&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;pResQRTsk&lt;/span&gt;&lt;span class="o"&gt;)));&lt;/span&gt;
&lt;span class="nt"&gt;END_IF&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Codesyscontrol Win x64, 3.5.19.10.&lt;/p&gt;
&lt;p&gt;Many thanks for any advice pointing to the correct direction.. :-)&lt;/p&gt;
&lt;p&gt;Regards,&lt;br/&gt;
Fabian&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Sys Process Execute Command</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/64904fac37/?limit=25#5f77" rel="alternate"/><published>2021-04-09T08:53:10.369000Z</published><updated>2021-04-09T08:53:10.369000Z</updated><author><name>ilyart</name><uri>https://forge.codesys.com/u/ilyart/</uri></author><id>https://forge.codesys.come6db16ed814a16a7cdeb86815d736f5d86f14c76</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Hi! Having hard times with SysProcessExecuteCommand. &lt;br/&gt;
Running on Raspberry, runtime 4.0.1.0&lt;/p&gt;
&lt;p&gt;CODESYSControl_User.cfg&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="k"&gt;[SysProcess]&lt;/span&gt;
&lt;span class="na"&gt;Command&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;AllowAll&lt;/span&gt;
&lt;span class="na"&gt;Command.0&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;shutdown&lt;/span&gt;
&lt;span class="c1"&gt;;Command.1=sudo&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;Executing any command returns zero.  If add double quotes it returns 25 as a result and doing noting.&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Sys Process Execute Command</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/64904fac37/?limit=25#654b" rel="alternate"/><published>2020-04-02T14:41:44.110000Z</published><updated>2020-04-02T14:41:44.110000Z</updated><author><name>ferrim</name><uri>https://forge.codesys.com/u/ferrim/</uri></author><id>https://forge.codesys.come07718a0edacbf33f49298d4742c05e4aaff1926</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Thank you very much, your advice works fine!&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Sys Process Execute Command</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/64904fac37/?limit=25#7406" rel="alternate"/><published>2020-04-02T13:52:12.186000Z</published><updated>2020-04-02T13:52:12.186000Z</updated><author><name>eschwellinger</name><uri>https://forge.codesys.com/u/eschwellinger/</uri></author><id>https://forge.codesys.com5143b37467b60014d3db37b9b38423e546dd6d97</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Hi,&lt;br/&gt;
we had a similar problem to execute VLC player, for us the solution was:&lt;br/&gt;
sudo -u pi DISPLAY=:0 vlc /home/pi/Videos/CODESYS.mp4&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Sys Process Execute Command</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/64904fac37/?limit=25#0f2e" rel="alternate"/><published>2020-04-02T12:47:28.540000Z</published><updated>2020-04-02T12:47:28.540000Z</updated><author><name>ferrim</name><uri>https://forge.codesys.com/u/ferrim/</uri></author><id>https://forge.codesys.com43808830861afa826769d831c9502ed818f35d66</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Hi,&lt;br/&gt;
my PLC is Elsist SlimLine Raspberry Pi 3b+ with Codesys runtime V3.5.15.40&lt;/p&gt;
&lt;p&gt;As first step I need to create a barcode with zint and this test code work fine:&lt;br/&gt;
&lt;img src="./attachment/BC-Generator.png" width="50%"/&gt;&lt;/p&gt;
&lt;p&gt;As second step I need to show the generated barcode on the HDMI display and I try with this code:&lt;br/&gt;
&lt;img src="./attachment/BC-Show.png" width="50%"/&gt;&lt;/p&gt;
&lt;p&gt;But doesn't work and then I try with other image viewer like Mirage, pqiv, ImageMagick but no success.&lt;br/&gt;
So I put this code (DISPLAY=:0 gpicview /home/pi/out.png) into a small shell script and I launch it from Codesys but it doesn't work.&lt;br/&gt;
Then I try to launch the shell script via ssh from Codesys but no success.&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Sys Process Execute Command</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/64904fac37/?limit=25#6024" rel="alternate"/><published>2020-04-02T05:21:42.499000Z</published><updated>2020-04-02T05:21:42.499000Z</updated><author><name>eschwellinger</name><uri>https://forge.codesys.com/u/eschwellinger/</uri></author><id>https://forge.codesys.comcab870fb519f00595444b729b16a2206a8eb674a</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;which plc and which version?&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Sys Process Execute Command</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/64904fac37/?limit=25#d3ea" rel="alternate"/><published>2020-04-01T13:15:34.701000Z</published><updated>2020-04-01T13:15:34.701000Z</updated><author><name>ferrim</name><uri>https://forge.codesys.com/u/ferrim/</uri></author><id>https://forge.codesys.com987ef8ffb5b0c5b530b86a76713e6bcb7352f8d8</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Same problem here...&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Sys Process Execute Command</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/64904fac37/?limit=25#fd13" rel="alternate"/><published>2020-02-27T14:16:51.923000Z</published><updated>2020-02-27T14:16:51.923000Z</updated><author><name>Frank Wenzel</name><uri>https://forge.codesys.com/u/frank-wenzel/</uri></author><id>https://forge.codesys.com658e783768b10f7406be3e52de0fb0301c059945</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Do we have a solution for that until now?&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Sys Process Execute Command</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/64904fac37/?limit=25#7630" rel="alternate"/><published>2020-02-27T14:16:51.532000Z</published><updated>2020-02-27T14:16:51.532000Z</updated><author><name>jbunel</name><uri>https://forge.codesys.com/u/jbunel/</uri></author><id>https://forge.codesys.com59067eda46e6256e38dec8c6a4630068b0719d09</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Hi i have exactly the same problem with Linux Runtime and RPI Runtime.&lt;br/&gt;
Only the "no graphic" command work. &lt;/p&gt;
&lt;p&gt;I tried to run with "su -l user -c 'app' command but it doesn't work too.&lt;/p&gt;
&lt;p&gt;Does Someone know a solution for that ?&lt;/p&gt;
&lt;p&gt;Thank you&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Sys Process Execute Command</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/64904fac37/?limit=25#0791" rel="alternate"/><published>2020-02-27T14:16:51.147000Z</published><updated>2020-02-27T14:16:51.147000Z</updated><author><name>jbunel</name><uri>https://forge.codesys.com/u/jbunel/</uri></author><id>https://forge.codesys.com1ff414e786c5b5026f8fd89297ef08270addc484</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Hi Edwin.&lt;br/&gt;
I use the last one so : 3.5.12.20&lt;/p&gt;
&lt;p&gt;I tried to move the setting  &lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="k"&gt;[SysProcess]&lt;/span&gt;
&lt;span class="na"&gt;Command&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;AllowAll&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;from /etc/CODESYSControl.cfg to /etc/CODESYSControl_User.cfg.&lt;br/&gt;
but same result.&lt;/p&gt;
&lt;p&gt;it seems that the runtime process does not have the rights to execute graphical applicaton&lt;/p&gt;&lt;/div&gt;</summary></entry></feed>