|
1 | | -# mb-service |
| 1 | +# Matterbridge Service Command |
| 2 | + |
| 3 | +A service management command-line utility for [Matterbridge](https://github.com/Luligu/matterbridge/), inspired by the [Homebridge Service Command](https://github.com/homebridge/homebridge-config-ui-x/wiki/Homebridge-Service-Command) `hb-service`. |
| 4 | + |
| 5 | +_This is currently experimental and only supports macOS with a default configuration at the moment!_ |
| 6 | + |
| 7 | +``` |
| 8 | +% npm -g install matterbridge |
| 9 | +% git clone https://github.com/michaelahern/mb-service.git |
| 10 | +% cd mb-service |
| 11 | +% npm install |
| 12 | +% npm run build |
| 13 | +% npm link |
| 14 | +
|
| 15 | +% mb-service |
| 16 | +Usage: mb-service <command> |
| 17 | +Commands: |
| 18 | + install Install the Matterbridge service |
| 19 | + uninstall Uninstall the Matterbridge service |
| 20 | + start Start the Matterbridge service |
| 21 | + stop Stop the Matterbridge service |
| 22 | + restart Restart the Matterbridge service |
| 23 | + pid Get the process id of the Matterbridge service |
| 24 | + tail Tail the Matterbridge log file |
| 25 | +
|
| 26 | +% sudo mb-service install |
| 27 | +Matterbridge Service Installed! |
| 28 | +Starting Matterbridge Service... |
| 29 | +
|
| 30 | +Manage Matterbridge in your browser at: |
| 31 | + * http://localhost:8283 |
| 32 | + * http://192.168.1.123:8283 |
| 33 | + * http://[fd08:b744:dfe5::123]:8283 |
| 34 | +``` |
| 35 | + |
| 36 | +## How This Project Uses `launchd` on macOS |
| 37 | + |
| 38 | +On macOS, `mb-service` manages the Matterbridge service using the native `launchd` system. It creates a Launch Daemon configuration file at `/Library/LaunchDaemons/com.matterbridge.plist`. This file tells `launchd` how to start, stop, and manage the Matterbridge process as a background service. |
| 39 | + |
| 40 | +You can inspect the service status and configuration using: |
| 41 | + |
| 42 | +``` |
| 43 | +% launchctl print system/com.matterbridge |
| 44 | +system/com.matterbridge = { |
| 45 | + active count = 1 |
| 46 | + path = /Library/LaunchDaemons/com.matterbridge.plist |
| 47 | + type = LaunchDaemon |
| 48 | + state = running |
| 49 | +
|
| 50 | + program = /opt/homebrew/bin/matterbridge |
| 51 | + arguments = { |
| 52 | + /opt/homebrew/bin/matterbridge |
| 53 | + -service |
| 54 | + } |
| 55 | +
|
| 56 | + stdout path = /Users/me/.matterbridge/matterbridge.log |
| 57 | + stderr path = /Users/me/.matterbridge/matterbridge.log |
| 58 | + default environment = { |
| 59 | + PATH => /usr/bin:/bin:/usr/sbin:/sbin |
| 60 | + } |
| 61 | +
|
| 62 | + environment = { |
| 63 | + PATH => /opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin |
| 64 | + HOME => /Users/me |
| 65 | + XPC_SERVICE_NAME => com.matterbridge |
| 66 | + } |
| 67 | +
|
| 68 | + ... |
| 69 | +} |
| 70 | +``` |
0 commit comments