formula-cookbook: update service docs

Add more info about the `run` method.
- Adds array example
- Adds OS specific example
This commit is contained in:
apainintheneck 2023-05-13 23:39:27 -07:00
parent b0dc84b117
commit 41c7eb7078

View File

@ -881,9 +881,21 @@ There are two ways to add `launchd` plists and `systemd` services to a formula,
2. If the formula does not provide a service file you can generate one using the following stanza: 2. If the formula does not provide a service file you can generate one using the following stanza:
```ruby ```ruby
# 1. An individual command
service do service do
run opt_bin/"script" run opt_bin/"script"
end end
# 2. A command with arguments
service do
run [opt_bin/"script", "--config", etc/"dir/config.yml"]
end
# 3. OS specific commands (If you omit one, the service file won't get generated for that OS.)
service do
run macos: [opt_bin/"macos_script", "standalone"],
linux: var/"special_linux_script"
end
``` ```
#### Service block methods #### Service block methods