3 homepage: https://git.rootprojects.org/root/serviceman
5 Serviceman: cross-platform service management for Linux, Mac, and Windows.
8 ## Updating `serviceman`
11 webi serviceman@stable
16 > Serviceman is a hassle-free wrapper around your system launcher. It works with
17 > the default system launcher to make it easy to start _user_- and
18 > _system_-level services, such as webservers, backup scripts, network and
25 - The Registry (Windows)
27 Serviceman can run an app in just about any programming language very simply.
29 If you'd like to learn what `serviceman` does without actually making changes,
30 add the `--dryrun` option.
35 sudo env PATH="$PATH" serviceman add bash ./backup.sh /mnt/data
40 **Development Server**
45 sudo env PATH="$PATH" \
46 serviceman add --system --cap-net-bind \
47 npx nodemon ./server.js
55 sudo env PATH="$PATH" \
56 serviceman add --system --cap-net-bind \
63 pushd ./my-go-package/
65 sudo env PATH="$PATH" \
66 serviceman add --system \
67 go run -mod=vendor cmd/my-service/*.go --port 3000
71 pushd ./my-go-package/
72 go build -mod=vendor cmd/my-service
74 sudo env PATH="$PATH" \
75 serviceman add --cap-net-bind --system \
76 ./my-service --port 80
79 ### How to see all services
82 serviceman list --system
83 serviceman list --user
87 serviceman-managed services:
92 ### How to restart a service
94 You can either `add` the service again (which will update any changed options),
95 or you can `stop` and then `start` any service by its name:
98 sudo env PATH="$PATH" serviceman stop example-service
99 sudo env PATH="$PATH" serviceman start example-service
102 ## What a typical systemd .service file looks like
106 Description=example-service
107 After=network-online.target
108 Wants=network-online.target systemd-networkd-wait-online.service
112 StartLimitInterval=10
118 WorkingDirectory=/srv/example-service
119 ExecStart=/srv/example-service/bin/example-command start
120 ExecReload=/bin/kill -USR1 $MAINPID
122 # Allow the program to bind on privileged ports, such as 80 and 443
123 CapabilityBoundingSet=CAP_NET_BIND_SERVICE
124 AmbientCapabilities=CAP_NET_BIND_SERVICE
128 WantedBy=multi-user.target
131 ## What a typical launchd .plist file looks like
134 <?xml version="1.0" encoding="UTF-8"?>
135 <!-- Generated for serviceman. Edit as you wish, but leave this line. -->
136 <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
137 <plist version="1.0">
140 <string>example-service</string>
141 <key>ProgramArguments</key>
143 <string>/Users/me/example-service/bin/example-command</string>
144 <string>start</string>
152 <key>WorkingDirectory</key>
153 <string>/Users/me/example-service</string>
155 <key>StandardErrorPath</key>
156 <string>/Users/me/.local/share/example-service/var/log/example-service.log</string>
157 <key>StandardOutPath</key>
158 <string>/Users/me/.local/share/example-service/var/log/example-service.log</string>
163 ### Use `--dryrun` to see the generated launcher config:
166 sudo env PATH="$PATH" \
167 serviceman add --system --dryrun \
168 bash ./backup.sh /mnt/data
171 ### See the (sub)command help
173 The main help, showing all subcommands:
179 Sub-command specific help:
182 serviceman add --help