From cdf00ddceb9ea2aa0b1abab84031dbc19c40d1c4 Mon Sep 17 00:00:00 2001 From: Neil Alexander Date: Sun, 28 Jan 2018 11:59:22 +0000 Subject: [PATCH] Add systemd service files --- contrib/systemd/yggdrasil-resume.service | 10 ++++++++++ contrib/systemd/yggdrasil.service | 20 ++++++++++++++++++++ 2 files changed, 30 insertions(+) create mode 100644 contrib/systemd/yggdrasil-resume.service create mode 100644 contrib/systemd/yggdrasil.service diff --git a/contrib/systemd/yggdrasil-resume.service b/contrib/systemd/yggdrasil-resume.service new file mode 100644 index 00000000..c725127b --- /dev/null +++ b/contrib/systemd/yggdrasil-resume.service @@ -0,0 +1,10 @@ +[Unit] +Description=Restart yggdrasil on resume from sleep +After=sleep.target + +[Service] +Type=oneshot +ExecStart=/bin/systemctl restart yggdrasil + +[Install] +WantedBy=sleep.target diff --git a/contrib/systemd/yggdrasil.service b/contrib/systemd/yggdrasil.service new file mode 100644 index 00000000..9ae4a079 --- /dev/null +++ b/contrib/systemd/yggdrasil.service @@ -0,0 +1,20 @@ +[Unit] +Description=yggdrasil +Wants=network.target +After=network.target + +[Service] +ProtectHome=true +ProtectSystem=true +SyslogIdentifier=yggdrasil +ExecStartPre=/bin/sh -ec "if ! test -s /etc/yggdrasil.conf; \ + then umask 077; \ + yggdrasil -genconf > /etc/yggdrasil.conf; \ + echo 'WARNING: A new /etc/yggdrasil.conf file has been generated.'; \ + fi" +ExecStart=/bin/sh -c "exec yggdrasil -useconf < /etc/yggdrasil.conf" +Restart=always + +[Install] +WantedBy=multi-user.target +Also=yggdrasil-resume.service