Skip to content

Commit

Permalink
Merge pull request #39 from inovex/systemd-timer
Browse files Browse the repository at this point in the history
docs: add systemd timer docs
  • Loading branch information
Alexander Huck authored Jul 17, 2023
2 parents 2d3c613 + f287daf commit 67eee9d
Showing 1 changed file with 57 additions and 0 deletions.
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: `CalendarSync.service`
- A [timer unit](https://www.freedesktop.org/software/systemd/man/systemd.timer.html) file: `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`

```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 🤞

0 comments on commit 67eee9d

Please sign in to comment.