Skip to content

Commit 3f12e84

Browse files
committed
Create systemd socket activation.
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.
1 parent a10fc74 commit 3f12e84

File tree

4 files changed

+37
-0
lines changed

4 files changed

+37
-0
lines changed

contrib/bash/cjdns-trap.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/usr/bin/env sh
2+
PIPE_NAME="client-core-$(tr -cd 'a-f0-9' < /dev/urandom | head -c 8)"
3+
(sleep 1 && /usr/bin/env cjdroute core "$PIPE_NAME" > /dev/null) &
4+
nc -lU "/tmp/cjdns_pipe_$PIPE_NAME"

contrib/systemd/README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
## How to install
2+
3+
```bash
4+
mv contrib/systemd/cjdn* /usr/lib/systemd/systemd/
5+
mv conrtib/bash/cjdns-trap.sh /usr/lib/systemd/scripts/
6+
```

contrib/systemd/cjdns.socket

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
[Unit]
2+
Description=Cjdns activation socket.
3+
4+
[Socket]
5+
ListenStream=/run/cjdns/cjdns.socket
6+
Accept=true
7+
SocketMode=0600
8+
9+
[Install]
10+
WantedBy=sockets.target
11+

contrib/systemd/cjdns@.service

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
[Unit]
2+
Description=cjdns-multinstant: routing engine designed for security, scalability, speed and ease of use
3+
Wants=network.target
4+
After=network.target
5+
Requires=cjdns.socket
6+
7+
[Service]
8+
ProtectHome=true
9+
ProtectSystem=true
10+
SyslogIdentifier=cjdroute
11+
12+
Type=forking
13+
ExecStart=/usr/lib/systemd/scripts/cjdns-trap.sh
14+
StandardInput=socket
15+
StandardOutput=socket
16+
StandardError=journal

0 commit comments

Comments
 (0)