Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/foolin/gosupervisor
golang client for the supervisord XML-RPC interface.
https://github.com/foolin/gosupervisor
Last synced: 3 days ago
JSON representation
golang client for the supervisord XML-RPC interface.
- Host: GitHub
- URL: https://github.com/foolin/gosupervisor
- Owner: foolin
- Created: 2016-09-18T08:30:54.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2017-01-14T03:45:02.000Z (almost 8 years ago)
- Last Synced: 2024-06-20T06:39:02.507Z (5 months ago)
- Language: Go
- Size: 2.93 KB
- Stars: 12
- Watchers: 3
- Forks: 5
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
golang client for the supervisord(http://www.supervisord.org/api.html) XML-RPC interface
# Getting started
go get github.com/foolin/gosupervisor
# Supervisor configuration
/etc/supervisord.conf
```ini
[inet_http_server] ; inet (TCP) server disabled by default
port=127.0.0.1:9001
```# Exmaples
```go
import (
"github.com/foolin/gosupervisor"
"log"
"time"
)
func main(){
rpcUrl := "http://127.0.0.1:9001/RPC2"
rpc := gosupervisor.New(rpcUrl)
version, err := rpc.GetAPIVersion()
println("GetAPIVersion")
printf("ret: %v, error: %v", version, err)
stopProgress, err := rpc.StopProcess("servername1", true)
println("StopProcess")
printf("ret: %v, error: %v", stopProgress, err)
startProcess, err := rpc.StartProcess("servername1", true)
println("StartProcess")
printf("ret: %v, error: %v", startProcess, err)
list, _ := rpc.GetAllProcessInfo()
println("GetAllProcessInfo")
printf("name\t\tstart\t\tdescription")
for _, v := range list{
printf("%v\t\t%v\t\t%v", v.Get("name"), time.Unix(v.Int64("start", 0), 0), v.Get("description"))
}
}
func println(v string) {
log.Printf("------------- %v -------------", v)
}
func printf(format string, v ...interface{}) {
log.Printf(format, v...)
}```