Starting the README and realized .Name should be .URL.

master
Zed A. Shaw 2 days ago
parent 3a5937b19b
commit a575c653cf
  1. 4
      .ozai.json
  2. 9
      README.md
  3. 2
      config/settings.go
  4. 8
      main.go

@ -1,12 +1,12 @@
{ {
"Processes": { "Processes": {
"tester1": { "tester1": {
"Name": "/tester1", "URL": "/tester1",
"Command": "tester", "Command": "tester",
"Args": ["-count", "100", "-id", "1"] "Args": ["-count", "100", "-id", "1"]
}, },
"tester2": { "tester2": {
"Name": "/tester2", "URL": "/tester2",
"Command": "tester", "Command": "tester",
"Args": ["-count", "500", "-id", "2"] "Args": ["-count", "500", "-id", "2"]
} }

@ -8,3 +8,12 @@ Ozai just does the minimal thing you want in a process watcher/restarter:
No random ass Hugo includes. No forced upgrades to the latest possible Go. No randomly included No random ass Hugo includes. No forced upgrades to the latest possible Go. No randomly included
entire web interfaces for no reason. Just the simplest thing needed for the task and no more. entire web interfaces for no reason. Just the simplest thing needed for the task and no more.
## Getting Started
## Config File Format
## Restart HTTP URLs

@ -12,7 +12,7 @@ import (
type Process struct { type Process struct {
Command string Command string
Args []string Args []string
Name string URL string
Ready chan string Ready chan string
ExecCmd *exec.Cmd ExecCmd *exec.Cmd
} }

@ -28,7 +28,7 @@ func LaunchProcess(proc *config.Process) {
proc.ExecCmd.Err = nil proc.ExecCmd.Err = nil
} }
fmt.Println("STARTING", proc.Name) fmt.Println("STARTING", proc.URL)
stderr, err := proc.ExecCmd.StderrPipe(); stderr, err := proc.ExecCmd.StderrPipe();
LaunchLogger(stderr, os.Stdout, err) LaunchLogger(stderr, os.Stdout, err)
@ -37,12 +37,12 @@ func LaunchProcess(proc *config.Process) {
LaunchLogger(stdout, os.Stdout, err) LaunchLogger(stdout, os.Stdout, err)
proc.ExecCmd.Start() proc.ExecCmd.Start()
fmt.Println("WAITING for", proc.Name) fmt.Println("WAITING for", proc.URL)
fmt.Println("SENDING READY on channel") fmt.Println("SENDING READY on channel")
proc.Ready<- "ready" proc.Ready<- "ready"
proc.ExecCmd.Wait() proc.ExecCmd.Wait()
fmt.Println("PROCESS", proc.Name, "EXITED") fmt.Println("PROCESS", proc.URL, "EXITED")
} }
} }
@ -58,7 +58,7 @@ func main() {
proc.Ready = make(chan string) proc.Ready = make(chan string)
go LaunchProcess(&proc) go LaunchProcess(&proc)
http.HandleFunc(proc.Name, func(w http.ResponseWriter, r *http.Request) { http.HandleFunc(proc.URL, func(w http.ResponseWriter, r *http.Request) {
<-proc.Ready <-proc.Ready
fmt.Println("!!!!!!!!!!!!!!!!!!! TIME TO DIE!!!!!") fmt.Println("!!!!!!!!!!!!!!!!!!! TIME TO DIE!!!!!")
err := proc.ExecCmd.Process.Kill() err := proc.ExecCmd.Process.Kill()

Loading…
Cancel
Save