spesnova / go-fleet

Go client library for fleet

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

go-fleet

Go client library for fleet

Install

go get github.com/spesnova/go-fleet

Usage

package main

import (
    "fmt"
    "log"

    "github.com/spesnova/go-fleet/fleet"
)

func main() {
    client := fleet.NewClient("http://10.1.42.1:49153")

	opts := []*fleet.UnitOption{
		&fleet.UnitOption{
			Section: "Unit",
			Name:    "Description",
			Value:   "Useless infinite loop",
		},
		&fleet.UnitOption{
			Section: "Service",
			Name:    "ExecStart",
			Value:   "/bin/bash -c \"while true; do echo 'hello' && sleep 1; done\"",
		},
	}

	err := client.Start("hello.service", opts)
	if err != nil {
		log.Fatal(err)
	} else {
		fmt.Println("Unit have started")
	}
}

License

See LICENSE file

About

Go client library for fleet

License:MIT License


Languages

Language:Go 100.0%