rb pi shell

5 years 4 months ago #1029 by Krecco
Hello,

is there a way of executing shell script from evet helper?

Please Log in or Create an account to join the conversation.

5 years 4 months ago #1032 by EasyIoT

Krecco wrote: Hello,

is there a way of executing shell script from evet helper?


Did you try:
System.Diagnostics.Process.Start("CMD.exe",strCmdText);

replace CMD.exe with your script and strCmdText is parameter.
The following user(s) said Thank You: Krecco

Please Log in or Create an account to join the conversation.

5 years 4 months ago #1038 by Krecco
I missed that! Thanks!

Please Log in or Create an account to join the conversation.

2 years 4 months ago #3928 by wmnbg
Hi,

But how can I give back some $Variables to the automation Script?

Please Log in or Create an account to join the conversation.

2 years 4 months ago #3931 by EasyIoT
Try this (it is not tested):
Process P = Process.Start(sPhysicalFilePath, Param);
P.WaitForExit();
int result = P.ExitCode;

Please Log in or Create an account to join the conversation.

2 years 4 months ago #3936 by wmnbg
Hi, thanks for your answer.
It works on my Raspberry EasyIoT Server.

The Test-ShellScript gives back the Param1 as Exitcode.

In the IOT-Automationscript, that runs every minute by CRON I have this.

public void Setup()
{
}

public void Run()
{
Console.WriteLine("Starting Shellscript by Cron");
System.Diagnostics.Process P = System.Diagnostics.Process.Start("sh","test.sh 123");
P.WaitForExit();
int result = P.ExitCode;
Console.Write("Exitcode: ");
Console.WriteLine(result);
Console.WriteLine("Shellscript by Cron done");
}


At the Console I get back the 123, what is set as parameter.
The following user(s) said Thank You: EasyIoT

Please Log in or Create an account to join the conversation.

Time to create page: 0.193 seconds

Forum latest

  • No posts to display.