To save others some time, here's how to call a shell script from HG:
(in my case it calls a shell that creates a text file with the weather and then a .wav file from the text)
Notes: Full path required to the shell command file, the "user" is "pi"
//Startup:
Program.UseWidget("homegenie/generic/program");
//Program:
Program.Notify("weatherCreateWav: ", "start");
var proc = new System.Diagnostics.Process {
StartInfo = new System.Diagnostics.ProcessStartInfo {
FileName = "sh",
Arguments = "/home/pi/sh/weatherTTS.sh",
UseShellExecute = false,
RedirectStandardOutput = true,
} // end ProcessStartInfo
}; //end Process
// This gets the data if something returned (i.e. "echo xxxx")
proc.Start();
while (!proc.StandardOutput.EndOfStream) {
string line = proc.StandardOutput.ReadLine();
Program.Notify("weatherCreateWav: Stream output:", line);
Pause(1);
} // end while EndOfStream
Program.Notify("weatherCreateWav: ", "complete");