Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: add systemd timer docs #39

Merged
merged 2 commits into from
Jul 17, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 57 additions & 0 deletions docs/systemd-timers.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# Running CalendarSync periodically using systemd

To run CalendarSync periodically / automatically on specific times using systemd, two files are necessary.

- A [service unit](https://www.freedesktop.org/software/systemd/man/systemd.service.html) file, which we will call: `CalendarSync.service`
alxndr13 marked this conversation as resolved.
Show resolved Hide resolved
- A [timer unit](https://www.freedesktop.org/software/systemd/man/systemd.timer.html) file, which we will call: `CalendarSync.timer`

The following content should be placed under: `.config/systemd/user/CalendarSync.service`:

```systemd
[Unit]
Description=Run CalendarSync

[Service]
ExecStart=/path/to/binary/calendarsync --config path/to/your/sync.yaml --storage-encryption-key $key
```

The following content should be placed under: `.config/systemd/user/CalendarSync.timer`:
alxndr13 marked this conversation as resolved.
Show resolved Hide resolved

```systemd
[Unit]
Description=Run CalendarSync regularly

[Timer]
OnCalendar=Mon..Fri 09:30
OnCalendar=Mon..Fri 11:40
Unit=calendarsync.service

[Install]
WantedBy=default.target
```

For more information check the [systemd docs](https://www.freedesktop.org/software/systemd/man/systemd.timer.html) on timer unit configurations.


After creation of the files, reload systemd using:

```bash
systemctl daemon-reload
```

and enable the service and timer:

```bash
systemctl enable --user CalendarSync.timer
```

check the status with:

```bash
systemctl status --user CalendarSync.timer
# and
systemctl list-timers --user
```

Now at the configured times CalendarSync should run and sync the events without
further intervention 🤞