diff --git a/etc/systemd/system/cjdns/README.md b/etc/systemd/system/cjdns/README.md new file mode 100644 index 00000000..0ba76851 --- /dev/null +++ b/etc/systemd/system/cjdns/README.md @@ -0,0 +1 @@ +These files are copied from https://github.com/cjdelisle/cjdns/tree/master/contrib/systemd/ and in case of cjdns.service the pathes are adjusted to how I am likely to be run it. diff --git a/etc/systemd/system/cjdns/cjdns-resume.service b/etc/systemd/system/cjdns/cjdns-resume.service new file mode 100644 index 00000000..3e6ce991 --- /dev/null +++ b/etc/systemd/system/cjdns/cjdns-resume.service @@ -0,0 +1,10 @@ +[Unit] +Description=Restart cjdns on resume from sleep +After=sleep.target + +[Service] +Type=oneshot +ExecStart=/bin/systemctl restart cjdns + +[Install] +WantedBy=sleep.target diff --git a/etc/systemd/system/cjdns/cjdns.service b/etc/systemd/system/cjdns/cjdns.service new file mode 100644 index 00000000..6383434e --- /dev/null +++ b/etc/systemd/system/cjdns/cjdns.service @@ -0,0 +1,20 @@ +[Unit] +Description=cjdns: routing engine designed for security, scalability, speed and ease of use +Wants=network.target +After=network.target + +[Service] +ProtectHome=true +ProtectSystem=true +SyslogIdentifier=cjdroute +ExecStartPre=/bin/sh -ec "if ! test -s /opt/cjdns/cjdroute.conf; \ + then umask 077; \ + /opt/cjdns/cjdroute --genconf > /opt/cjdns/cjdroute.conf; \ + echo 'WARNING: A new /opt/cjdns/cjdroute.conf file has been generated.'; \ + fi" +ExecStart=/bin/sh -c "exec /opt/cjdns/cjdroute --nobg < /opt/cjdns/cjdroute.conf" +Restart=always + +[Install] +WantedBy=multi-user.target +Also=cjdns-resume.service