update docs
[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 `--dry-run` option.
19
20 ### Node.js
21
22 **Development Server**
23
24 ```bash
25 pushd ./my-node-app/
26 sudo env PATH="$PATH" \
27     serviceman add --cap-net-bind --system npx nodemon
28 ```
29
30 **Production Server**
31
32 ```bash
33 pushd ./my-node-app/
34 sudo env PATH="$PATH" \
35     serviceman add --cap-net-bind --system npm start
36 ```
37
38 ### Golang
39
40 ```bash
41 pushd ./my-go-package/
42 sudo env PATH="$PATH" \
43     serviceman add --system go run -mod=vendor cmd/my-service/*.go --port 3000
44 ```
45
46 ```bash
47 pushd ./my-go-package/
48 go build -mod=vendor cmd/my-service
49 sudo env PATH="$PATH" \
50     serviceman add --cap-net-bind --system ./my-service --port 80
51 ```
52
53 ### And even bash!
54
55 ```bash
56 sudo env PATH="$PATH" serviceman add bash ./backup.sh /mnt/data
57 ```
58
59 ### Use `--dry-run` to see the generated launcher config:
60
61 ```bash
62 sudo env PATH="$PATH" \
63     serviceman add --dryrun bash ./backup.sh /mnt/data
64 ```
65
66 ### See the (sub)command help
67
68 The main help, showing all subcommands:
69
70 ```bash
71 serviceman --help
72 ```
73
74 Sub-command specific help:
75
76 ```bash
77 serviceman add --help
78 ```