Compare commits

..

6 Commits

Author SHA1 Message Date
32c71bd698 add webi install instructions 2020-07-06 02:42:08 +00:00
8277fa7ac6 add canonical link 2020-04-22 19:22:41 +00:00
3b6c4bbb7d update curl command 2020-01-18 02:18:08 +00:00
1196f1d389 more generic download command 2020-01-18 02:16:15 +00:00
2824ee4c62 test service directory creation 2019-08-10 20:13:51 -06:00
e7a02191d8 lint: clarify double newline 2019-08-10 20:12:43 -06:00
4 changed files with 72 additions and 6 deletions

View File

@ -1,4 +1,4 @@
# go-serviceman
# [go-serviceman](https://git.rootprojects.org/root/serviceman)
Cross-platform service management made easy.
@ -77,6 +77,24 @@ The **default** is to register a _user_ services. To register a _system_ service
# Install
You can install `serviceman` directly from the official git releases with [`webi`](https://webinstall.dev/serviceman):
**Mac**, **Linux**:
```bash
curl -sL https://webinstall.dev/serviceman | bash
```
**Windows 10**:
```pwsh
curl.exe -sLA "MS" https://webinstall.dev/serviceman | powershell
```
You can run this from cmd.exe or PowerShell (curl.exe is a native part of Windows 10).
## Manual Install
There are a number of pre-built binaries.
If none of them work for you, or you prefer to build from source,
@ -84,8 +102,16 @@ see the instructions for building far down below.
## Downloads
```
curl -fsSL "https://rootprojects.org/serviceman/dist/$(uname -s)/$(uname -m)/serviceman" -o serviceman
chmod +x ./serviceman
```
### MacOS
<details>
<summary>See download options</summary>
MacOS (darwin): [64-bit Download ](https://rootprojects.org/serviceman/dist/darwin/amd64/serviceman)
```
@ -93,6 +119,8 @@ curl https://rootprojects.org/serviceman/dist/darwin/amd64/serviceman -o service
chmod +x ./serviceman
```
</details>
### Windows
<details>
@ -125,6 +153,7 @@ powershell.exe "(New-Object Net.WebClient).DownloadFile('https://rootprojects.or
### Linux
<details>
<summary>See download options</summary>
@ -620,4 +649,3 @@ MPL-2.0 |
Copyright 2019 AJ ONeal.
<!-- {{ end }} -->
<!-- {{ end }} -->

View File

@ -3,6 +3,7 @@ package manager
import (
"fmt"
"io/ioutil"
"os"
"os/exec"
"path/filepath"
"strings"
@ -121,7 +122,12 @@ func getSystemSrvs() ([]string, error) {
}
func getUserSrvs(home string) ([]string, error) {
return getSrvs(filepath.Join(home, srvUserPath))
confDir := filepath.Join(home, srvUserPath)
err := os.MkdirAll(confDir, 0755)
if nil != err {
return nil, err
}
return getSrvs(confDir)
}
// "come.example.foo.plist" matches "foo"

View File

@ -0,0 +1,32 @@
package manager
import (
"fmt"
"io/ioutil"
"os"
"path/filepath"
"testing"
)
func TestEmptyUserServicePath(t *testing.T) {
srvs, err := getUserSrvs("/tmp/fakeuser")
if nil != err {
t.Fatal(err)
}
if len(srvs) > 0 {
t.Fatal(fmt.Errorf("sanity fail: shouldn't get services from empty directory"))
}
dirs, err := ioutil.ReadDir(filepath.Join("/tmp/fakeuser", srvUserPath))
if nil != err {
t.Fatal(err)
}
if len(dirs) > 0 {
t.Fatal(fmt.Errorf("sanity fail: shouldn't get listing from empty directory"))
}
err = os.RemoveAll("/tmp/fakeuser")
if nil != err {
panic("couldn't remove /tmp/fakeuser")
}
}

View File

@ -230,7 +230,7 @@ func add() {
}
if len(ass) > 0 {
fmt.Println("OPTIONS: Making some assumptions...\n")
fmt.Printf("OPTIONS: Making some assumptions...\n\n")
for i := range ass {
fmt.Println("\t" + ass[i])
}
@ -350,7 +350,7 @@ func list() {
fmt.Fprintf(os.Stderr, "\n")
}
fmt.Println("serviceman-managed services:\n")
fmt.Printf("serviceman-managed services:\n\n")
for i := range managed {
fmt.Println("\t" + managed[i])
}
@ -360,7 +360,7 @@ func list() {
fmt.Println("")
if verbose {
fmt.Println("other services:\n")
fmt.Printf("other services:\n\n")
for i := range others {
fmt.Println("\t" + others[i])
}