Skip to content
This repository has been archived by the owner on Jun 30, 2021. It is now read-only.

Commit

Permalink
add instructions to install a systemd service
Browse files Browse the repository at this point in the history
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
  • Loading branch information
anarcat committed Feb 19, 2019
1 parent b94241a commit fbf259e
Show file tree
Hide file tree
Showing 5 changed files with 70 additions and 0 deletions.
30 changes: 30 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
---------------------

Expand Down
12 changes: 12 additions & 0 deletions misc/smd-pull.service
Original file line number Diff line number Diff line change
@@ -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
8 changes: 8 additions & 0 deletions misc/smd-pull.timer
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[Unit]
Description=run smd-pull regularly

[Timer]
OnCalendar=*:0/2

[Install]
WantedBy=timers.target
12 changes: 12 additions & 0 deletions misc/smd-push.service
Original file line number Diff line number Diff line change
@@ -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
8 changes: 8 additions & 0 deletions misc/smd-push.timer
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[Unit]
Description=run smd-push regularly

[Timer]
OnCalendar=*:0/2

[Install]
WantedBy=timers.target

0 comments on commit fbf259e

Please sign in to comment.