Added ability to run commands in a shell
Diverges a small amount from the Python version for this.
This commit is contained in:
+4
-2
@@ -10,7 +10,7 @@ type Monitor struct {
|
||||
// Config values
|
||||
Name string
|
||||
Command []string
|
||||
CommandShell string `yaml:"command_shell`
|
||||
CommandShell string `yaml:"command_shell"`
|
||||
AlertDown []string `yaml:"alert_down"`
|
||||
AlertUp []string `yaml:"alert_up"`
|
||||
CheckInterval float64 `yaml:"check_interval"`
|
||||
@@ -45,7 +45,9 @@ func (monitor *Monitor) Check() bool {
|
||||
cmd = exec.Command(monitor.Command[0], monitor.Command[1:]...)
|
||||
} else {
|
||||
// TODO: Handle a command shell as well. This is untested
|
||||
cmd = exec.Command(monitor.CommandShell)
|
||||
|
||||
//cmd = exec.Command("sh", "-c", "echo \"This is a test of the command system\"")
|
||||
cmd = ShellCommand(monitor.CommandShell)
|
||||
}
|
||||
|
||||
output, err := cmd.CombinedOutput()
|
||||
|
||||
Reference in New Issue
Block a user