docs cleanup
[webi-installers/.git] / serviceman / README.md
1 ---
2 title: Serviceman
3 homepage: https://git.rootprojects.org/root/serviceman
4 tagline: |
5   Serviceman: cross-platform service management for Linux, Mac, and Windows.
6 description: |
7   Serviceman is a hassle-free wrapper around your system launcher. It works with the default system launcher to make it easy to start _user_- and _system_-level services, such as webservers, backup scripts, network and system tools, etc.
8
9   Supports
10     - `launchctl` (macOS)
11     - `systemctl` (Linux)
12     - The Registry (Windows)
13 ---
14
15 Serviceman can run an app in just about any programming language very simply.
16
17 If you'd like to learn what `serviceman` does without actually making changes,
18 add the `--dryrun` option.
19
20 ### Node.js
21
22 **Development Server**
23
24 ```bash
25 pushd ./my-node-app/
26
27 sudo env PATH="$PATH" \
28     serviceman add --system --cap-net-bind npx nodemon
29 ```
30
31 **Production Server**
32
33 ```bash
34 pushd ./my-node-app/
35
36 sudo env PATH="$PATH" \
37     serviceman add --system --cap-net-bind npm start
38 ```
39
40 ### Golang
41
42 ```bash
43 pushd ./my-go-package/
44
45 sudo env PATH="$PATH" \
46     serviceman add --system \
47     go run -mod=vendor cmd/my-service/*.go --port 3000
48 ```
49
50 ```bash
51 pushd ./my-go-package/
52 go build -mod=vendor cmd/my-service
53
54 sudo env PATH="$PATH" \
55     serviceman add --cap-net-bind --system \
56     ./my-service --port 80
57 ```
58
59 ### And even bash!
60
61 ```bash
62 sudo env PATH="$PATH" serviceman add bash ./backup.sh /mnt/data
63 ```
64
65 ### Use `--dryrun` to see the generated launcher config:
66
67 ```bash
68 sudo env PATH="$PATH" \
69     serviceman add --system --dryrun \
70     bash ./backup.sh /mnt/data
71 ```
72
73 ### See the (sub)command help
74
75 The main help, showing all subcommands:
76
77 ```bash
78 serviceman --help
79 ```
80
81 Sub-command specific help:
82
83 ```bash
84 serviceman add --help
85 ```