Added 'Multiple system buses' section

groupnet 2019-06-04 15:49:10 +02:00
parent 77afe424a3
commit 5b8c758c22

@ -39,6 +39,35 @@ Example with `dbus-send`:
dbus-send --session --type=method_call --print-reply --dest="org.asamk.Signal" /org/asamk/Signal org.asamk.Signal.sendMessage string:MessageText array:string: string:RECIPIENT
### Multiple system buses
As an extension to [System Bus](DBus-service#system-bus), you can run multiple daemons with different bus names by providing the `--busname` parameter. In this guide we use the bus naming scheme 'org.asamk.Signal_NUMBER' where NUMBER is the user number **without** the leading + sign.
Again, the following steps assume you created a user named *signal-cli*.
For each (named) system bus, a config file is needed to allow the signal-cli user to take a name on the system bus. An template config file can be found in `data/org.asamk.Signal_NUMBER.conf`. This file also configures that any user can talk with the signal-cli daemon.
The `data/signal-cli@.service` file configures a systemd service template that takes the NUMBER as argument. We start each service when systemd's _multi-user.target_ is reached.
Executed these commands **once** as root to provide the signal-cli systemd service:
```bash
sed -e "s|%dir%|<INSERT_INSTALL_PATH>|" data/signal-cli@.service > /etc/systemd/system/signal-cli@.service
systemctl daemon-reload
```
Mind the fact that signal.service executes the signal-cli with "--config /var/lib/signal-cli".
If you registered with user signal-cli, remove the config option.
Executed these commands **for each number** as root to provide the corresponding dbus configuration:
```bash
sed -e "s|%number%|<INSERT_YOUR_NUMBER>|" data/org.asamk.Signal_NUMBER.conf > /etc/dbus-1/system.d/org.asamk.Signal_<INSERT_YOUR_NUMBER>.conf
systemctl reload dbus.service
systemctl enable signal-cli@<INSERT_YOUR_NUMBER>.service
systemctl start signal-cli@<INSERT_YOUR_NUMBER>.service
```
Make sure to use "--dbus-system" and "--dbusname 'org.asamk.Signal_NUMBER'" with the send command.
### Receive messages from signal-cli daemon
The signal-cli daemon publishes new messages to dbus.
Here's an example using python: