3 homepage: https://git.rootprojects.org/root/serviceman
5 Serviceman: cross-platform service management for Linux, Mac, and Windows.
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.
12 - The Registry (Windows)
15 Serviceman can run an app in just about any programming language very simply.
17 If you'd like to learn what `serviceman` does without actually making changes,
18 add the `--dryrun` option.
22 **Development Server**
27 sudo env PATH="$PATH" \
28 serviceman add --system --cap-net-bind \
29 npx nodemon ./server.js
37 sudo env PATH="$PATH" \
38 serviceman add --system --cap-net-bind \
45 pushd ./my-go-package/
47 sudo env PATH="$PATH" \
48 serviceman add --system \
49 go run -mod=vendor cmd/my-service/*.go --port 3000
53 pushd ./my-go-package/
54 go build -mod=vendor cmd/my-service
56 sudo env PATH="$PATH" \
57 serviceman add --cap-net-bind --system \
58 ./my-service --port 80
64 sudo env PATH="$PATH" serviceman add bash ./backup.sh /mnt/data
67 ### How to see all services
70 serviceman list --system
71 serviceman list --user
75 serviceman-managed services:
80 ### How to restart a service
82 You can either `add` the service again (which will update any changed options),
83 or you can `stop` and then `start` any service by its name:
86 sudo env PATH="$PATH" serviceman stop example-service
87 sudo env PATH="$PATH" serviceman start example-service
90 ## What a typical systemd .service file looks like
94 Description=example-service
95 After=network-online.target
96 Wants=network-online.target systemd-networkd-wait-online.service
100 StartLimitInterval=10
106 WorkingDirectory=/srv/example-service
107 ExecStart=/srv/example-service/bin/example-command start
108 ExecReload=/bin/kill -USR1 $MAINPID
110 # Allow the program to bind on privileged ports, such as 80 and 443
111 CapabilityBoundingSet=CAP_NET_BIND_SERVICE
112 AmbientCapabilities=CAP_NET_BIND_SERVICE
116 WantedBy=multi-user.target
119 ## What a typical launchd .plist file looks like
122 <?xml version="1.0" encoding="UTF-8"?>
123 <!-- Generated for serviceman. Edit as you wish, but leave this line. -->
124 <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
125 <plist version="1.0">
128 <string>example-service</string>
129 <key>ProgramArguments</key>
131 <string>/Users/me/example-service/bin/example-command</string>
132 <string>start</string>
140 <key>WorkingDirectory</key>
141 <string>/Users/me/example-service</string>
143 <key>StandardErrorPath</key>
144 <string>/Users/me/.local/share/example-service/var/log/example-service.log</string>
145 <key>StandardOutPath</key>
146 <string>/Users/me/.local/share/example-service/var/log/example-service.log</string>
151 ### Use `--dryrun` to see the generated launcher config:
154 sudo env PATH="$PATH" \
155 serviceman add --system --dryrun \
156 bash ./backup.sh /mnt/data
159 ### See the (sub)command help
161 The main help, showing all subcommands:
167 Sub-command specific help:
170 serviceman add --help