From fbf259e4e31f00a6c297c1d4ff320ac61a5c2b3b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antoine=20Beaupr=C3=A9?= Date: Tue, 19 Feb 2019 16:22:13 -0500 Subject: [PATCH] add instructions to install a systemd service I have removed the `--verbose` option which I tested here because it doesn't do anything, see #11. Otherwise this is pretty much what I'm using in production now. Closes: #10 --- README.md | 30 ++++++++++++++++++++++++++++++ misc/smd-pull.service | 12 ++++++++++++ misc/smd-pull.timer | 8 ++++++++ misc/smd-push.service | 12 ++++++++++++ misc/smd-push.timer | 8 ++++++++ 5 files changed, 70 insertions(+) create mode 100644 misc/smd-pull.service create mode 100644 misc/smd-pull.timer create mode 100644 misc/smd-push.service create mode 100644 misc/smd-push.timer diff --git a/README.md b/README.md index fb7d6aa..14c3a8e 100644 --- a/README.md +++ b/README.md @@ -189,6 +189,36 @@ can be run with `--configure` to pop-up its configuration window, that allows to tune its notification behaviour and to edit the configuration files for `smd-loop` and `smd-push/pull`. +### systemd integration + +`smd-pull` and `smd-push` can be configured as user services that get +automatically run under [`systemd`][]. The following units are provided: + +- [`smd-push.service`](misc/smd-push.service) +- [`smd-push.timer`](misc/smd-push.timer) +- [`smd-pull.service`](misc/smd-pull.service) +- [`smd-pull.timer`](misc/smd-pull.timer) + +Those should be installed in `~/.config/systemd/user/` and enabled +like this: + + systemctl --user daemon-reload + systemctl enable smd-push.service smd-push.timer smd-pull.service smd-pull.timer + +Then you should see progress from those jobs in the journal: + + journalctl --user -f + +You might need to enable [`journald`][] persistence by enabling the +`Storage` paramter in [`journald.conf`][]. This is generally simply a +matter of creating the storage directory, with: + + sudo mkdir /var/log/journal + +[`systemd`]: https://freedesktop.org/wiki/Software/systemd/ +[`journald`]: https://www.freedesktop.org/software/systemd/man/systemd-journald.service.html +[`journald.conf`]: https://www.freedesktop.org/software/systemd/man/journald.conf.html + Notes on performances --------------------- diff --git a/misc/smd-pull.service b/misc/smd-pull.service new file mode 100644 index 0000000..7a9461e --- /dev/null +++ b/misc/smd-pull.service @@ -0,0 +1,12 @@ +[Unit] +Description=pull emails with syncmaildir +Wants=network-online.target +After=network-online.target + +[Service] +Type=oneshot +# --show-tags gives email counts +ExecStart=/usr/bin/smd-pull --show-tags + +[Install] +WantedBy=multi-user.target diff --git a/misc/smd-pull.timer b/misc/smd-pull.timer new file mode 100644 index 0000000..0810ee1 --- /dev/null +++ b/misc/smd-pull.timer @@ -0,0 +1,8 @@ +[Unit] +Description=run smd-pull regularly + +[Timer] +OnCalendar=*:0/2 + +[Install] +WantedBy=timers.target diff --git a/misc/smd-push.service b/misc/smd-push.service new file mode 100644 index 0000000..c369fa7 --- /dev/null +++ b/misc/smd-push.service @@ -0,0 +1,12 @@ +[Unit] +Description=push emails with syncmaildir +Wants=network-online.target +After=smd-pull.service + +[Service] +Type=oneshot +# --show-tags gives email counts +ExecStart=/usr/bin/smd-push --show-tags + +[Install] +WantedBy=multi-user.target diff --git a/misc/smd-push.timer b/misc/smd-push.timer new file mode 100644 index 0000000..c0b3c58 --- /dev/null +++ b/misc/smd-push.timer @@ -0,0 +1,8 @@ +[Unit] +Description=run smd-push regularly + +[Timer] +OnCalendar=*:0/2 + +[Install] +WantedBy=timers.target