Compare commits
2
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
cd439be109
|
||
|
|
2718d8531e
|
No files matched your search
@@ -6,3 +6,4 @@ ExecStart=/home/fuxino/.fehbg
|
||||
Type=simple
|
||||
Restart=no
|
||||
ProtectHome=read-only
|
||||
ReadWritePaths=%C
|
||||
@@ -0,0 +1,11 @@
|
||||
[Unit]
|
||||
Description=Dump the Library database to ~/.local/share/library_manager/dumps
|
||||
StartLimitIntervalSec=2h
|
||||
StartLimitBurst=4
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
ExecStart=%h/.local/bin/library-dump
|
||||
# MariaDB not up yet (e.g. caught up right after boot)? retry a few times
|
||||
Restart=on-failure
|
||||
RestartSec=5min
|
||||
@@ -0,0 +1,9 @@
|
||||
[Unit]
|
||||
Description=Dump the Library database daily
|
||||
|
||||
[Timer]
|
||||
OnCalendar=daily
|
||||
Persistent=true
|
||||
|
||||
[Install]
|
||||
WantedBy=timers.target
|
||||
+1
-1
@@ -17,7 +17,7 @@ install script. This README lives in `.github/` to keep it out of the home direc
|
||||
| Audio / media | mpd, ncmpcpp, mpDris2, mpv, beets, pipewire |
|
||||
| Packaging | `.config/aurutils-makepkg.conf`, `.config/aurb/`, `.local/bin/aurb` / `aurs` (aurutils wrappers) |
|
||||
| Services | `.config/systemd/user/` (timers and overrides) |
|
||||
| Scripts | `.local/bin/` (screen layout, phone mount, video helpers) |
|
||||
| Scripts | `.local/bin/` (screen layout, phone mount, video helpers, Library database dump) |
|
||||
|
||||
Note: `config.fish` sources `~/.bash_aliases`, so the aliases apply in both shells.
|
||||
|
||||
|
||||
Executable
+17
@@ -0,0 +1,17 @@
|
||||
#!/bin/bash
|
||||
# Dump the Library database to a per-weekday file (seven self-rotating copies).
|
||||
set -euo pipefail
|
||||
|
||||
cnf=${XDG_CONFIG_HOME:-$HOME/.config}/library_manager/dump.cnf
|
||||
dir=${XDG_DATA_HOME:-$HOME/.local/share}/library_manager/dumps
|
||||
out=$dir/Library-$(LC_ALL=C date +%a).sql.gz
|
||||
|
||||
umask 077
|
||||
mkdir -p "$dir"
|
||||
|
||||
# Write to a temporary file so a failed dump never replaces a good one
|
||||
tmp=$(mktemp "$dir/.dump.XXXXXX")
|
||||
trap 'rm -f "$tmp"' EXIT
|
||||
|
||||
mariadb-dump --defaults-extra-file="$cnf" --single-transaction --databases Library | gzip > "$tmp"
|
||||
mv "$tmp" "$out"
|
||||
Reference in new issue
Block a user