more G-Labs products

Author Topic: Python script  (Read 411 times)

November 23, 2016, 04:04:03 AM
Read 411 times

GlenDLF

  • *
  • Information
  • Newbie
  • Posts: 6
I have been unable to get the email system working.  My goal is to get the security system to send me an email when an alarm occurs.  I have written a python script on the raspberry: /home/pi/Alarm.py which will send me an email when executed from a raspberry terminal window with the command: python Alarm.py   

How can I execute this script from within HG?

Thanks,
Glen

November 23, 2016, 10:32:56 PM
Reply #1

nolio

  • *****
  • Information
  • Global Moderator
  • Posts: 544
You can launch a command line with something like that :
Code: [Select]
      var proc = new System.Diagnostics.Process {
          StartInfo = new System.Diagnostics.ProcessStartInfo {
              FileName = "/bin/bash",
              Arguments = "-c \"echo '"+text+"' | gammu-smsd-inject TEXT "+tel+"\"",           
              UseShellExecute = false,
              RedirectStandardOutput = true,
              CreateNoWindow = true
          }
      };
      proc.Start();
      while (!proc.StandardOutput.EndOfStream) {
          string line = proc.StandardOutput.ReadLine();
          Program.Notify("SHELL COMMAND", line);
      }

But i advise to solve you problem  ;)