Repository navigation
Expand file tree
/
Copy pathgitnotesync@.service
More file actions
47 lines (41 loc) · 1.94 KB
/
Copy pathgitnotesync@.service
File metadata and controls
47 lines (41 loc) · 1.94 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# Watch one notes repository. This is a template unit: the instance name is the
# vault's absolute path, systemd-escaped, so one copy of this file serves every
# vault you have.
#
# The deb and rpm packages install this to /usr/lib/systemd/user with ExecStart
# rewritten to /usr/bin/gitnotesync. Otherwise, with the binary in ~/.local/bin:
#
# install -Dm644 gitnotesync@.service ~/.config/systemd/user/gitnotesync@.service
# systemctl --user daemon-reload
# systemctl --user enable --now "gitnotesync@$(systemd-escape --path ~/notes)"
#
# Each vault is then its own service: restart, stop and read the logs of one
# without touching the others.
#
# systemctl --user status "gitnotesync@$(systemd-escape --path ~/notes)"
# journalctl --user -u "gitnotesync@$(systemd-escape --path ~/notes)" -f
[Unit]
Description=Sync notes in /%I
Documentation=https://github.com/kvth/gitnotesync
After=network-online.target
Wants=network-online.target
[Service]
# Type=notify lets the daemon report what it is doing through sd_notify(3), so
# that `systemctl --user status` shows the last sync -- or, more to the point,
# that syncing has been blocked on a conflict since Tuesday. Without it a unit
# whose syncs all fail looks exactly like a healthy one: "active (running)".
Type=notify
# %I is the unescaped instance name, which has no leading slash of its own.
ExecStart=%h/.local/bin/gitnotesync watch /%I
Restart=always
RestartSec=30
# git is taken from PATH. Point this at another one to use a different git.
# Environment=PATH=%h/.local/bin:/usr/local/bin:/usr/bin:/bin
# Pushing over SSH needs the agent socket, and a user unit does not always
# inherit it. If pushes fail with "Permission denied (publickey)", set it --
# gnome-keyring uses %t/keyring/ssh, systemd's ssh-agent.service uses
# %t/ssh-agent.socket -- or run `systemctl --user import-environment SSH_AUTH_SOCK`
# from a logged-in shell.
# Environment=SSH_AUTH_SOCK=%t/keyring/ssh
[Install]
WantedBy=default.target