Automatically synchronise an Obsidian vault with a Git repository
  • Shell 98.2%
  • Makefile 1.8%
Find a file
benmandrew 2f4de282b9
fix(notify): dismiss stale GNOME alert banners after recovery
`notify` posted failure alerts with `-u critical`, which GNOME treats
as resident, so they never expire on their own. `notify_clear` only
removed the throttle stamp file; it never took the banner down, so a
backup that failed once and then recovered left a permanent banner on
screen.

`notify` now records the id of the notification it posts, and
`notify_clear` closes that notification. The id has to come from the
`org.freedesktop.Notifications.Notify` D-Bus method via `gdbus`, since
`notify-send --print-id` only arrived in libnotify 0.8 and Ubuntu
ships 0.7.9; when `gdbus` is absent, notifications still fall back to
plain `notify-send` with no id recorded. The recorded id is stored
alongside the kernel boot id and only acted on when that still
matches, since notification ids restart at 1 when the notification
server does, so an id recorded before a reboot would otherwise close
an unrelated notification that inherited the number. `notify` also now
closes the previous alert before posting a new one, so continuous
failure keeps one banner rather than stacking one per throttle window.

The DISPLAY / DBUS_SESSION_BUS_ADDRESS discovery for cron is pulled
out of `notify` into `notify_env`, since `notify_clear` needs it too
on the success path, where cron leaves neither variable set. That move
also fixes a stderr leak: reading /proc/<pid>/environ fails under
Ubuntu's ptrace scope for processes that are not descendants, and the
resulting "Permission denied" was reaching stderr and getting mailed
by cron. The 2>/dev/null now precedes the input redirect so it is in
place before the open can fail.
2026-08-17 13:15:17 +01:00
.github/workflows feat(ci): Add fmt-ci target and improve lint CI 2026-02-09 13:11:23 +00:00
LICENCE feat(doc): Add LICENCE and improve README 2026-01-23 12:57:27 +00:00
Makefile feat(ci): Add fmt-ci target and improve lint CI 2026-02-09 13:11:23 +00:00
obsync.sh feat: alert on every failure, and make notifications work on macOS 2026-07-26 22:33:51 +01:00
README.md fix(doc): Remove incorrect env var from README 2026-02-17 16:47:13 +00:00
utils.sh fix(notify): dismiss stale GNOME alert banners after recovery 2026-08-17 13:15:17 +01:00

obsync

Synchronises an Obsidian vault to a Git repository. Can be run automatically with cron. For example,

$ crontab -e
0 * * * * cd $HOME/projects/obsync && /bin/bash obsync.sh $HOME/obsidian-vault

Format

Using shfmt.

$ make fmt

Lint

Using shellcheck.

$ make lint