Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create systemd socket activation.
Browse files Browse the repository at this point in the history
In future the socket activation IMHO should be standard way of starting
cjdns. Thanks to that configurators don't have to know anything about
cjdroute placement to start cjdns.
Kubuxu committed Nov 17, 2015
1 parent a10fc74 commit a31f27b
Showing 4 changed files with 37 additions and 0 deletions.
4 changes: 4 additions & 0 deletions contrib/bash/cjdns-trap.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env sh
PIPE_NAME="client-core-$(tr -cd 'a-f0-9' < /dev/urandom | head -c 8)"
(sleep 1 && /usr/bin/env cjdroute core "$PIPE_NAME" > /dev/null) &
nc -lU "/tmp/cjdns_pipe_$PIPE_NAME"
6 changes: 6 additions & 0 deletions contrib/systemd/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
## How to install

```bash
mv contrib/systemd/cjdns* /usr/lib/systemd/systemd/
mv conrtib/bash/cjdns-trap.sh /usr/lib/systemd/scripts/
```
11 changes: 11 additions & 0 deletions contrib/systemd/cjdns.socket
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[Unit]
Description=Cjdns activation socket.

[Socket]
ListenStream=/run/cjdns/cjdns.socket
Accept=true
SocketMode=0600

[Install]
WantedBy=sockets.target

16 changes: 16 additions & 0 deletions contrib/systemd/cjdns@.service
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
[Unit]
Description=cjdns-multinstant: routing engine designed for security, scalability, speed and ease of use
Wants=network.target
After=network.target
Requires=cjdns.socket

[Service]
ProtectHome=true
ProtectSystem=true
SyslogIdentifier=cjdroute

Type=forking
ExecStart=/usr/lib/systemd/scripts/cjdns-trap.sh
StandardInput=socket
StandardOutput=socket
StandardError=journal

0 comments on commit a31f27b

Please sign in to comment.