rb pi shell

9 years 7 months ago #1029 by Krecco
rb pi shell was created 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.

9 years 7 months ago #1032 by EasyIoT
Replied by EasyIoT on topic rb pi shell

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.

9 years 7 months ago #1038 by Krecco
Replied by Krecco on topic rb pi shell
I missed that! Thanks!

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

6 years 7 months ago #3928 by wmnbg
Replied by wmnbg on topic rb pi shell
Hi,

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

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

6 years 7 months ago #3931 by EasyIoT
Replied by EasyIoT on topic rb pi shell
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.

6 years 7 months ago #3936 by wmnbg
Replied by wmnbg on topic rb pi shell
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.639 seconds

Forum latest

  • No posts to display.