Compare commits
2
Commits
5b6e381c89
...
b76ae5c3f6
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b76ae5c3f6
|
||
|
|
90a81ea960
|
No files matched your search
@@ -0,0 +1,11 @@
|
|||||||
|
[Unit]
|
||||||
|
Description=Dump the Weather database to ~/.local/share/ens-forecast/dumps
|
||||||
|
StartLimitIntervalSec=2h
|
||||||
|
StartLimitBurst=4
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
Type=oneshot
|
||||||
|
ExecStart=%h/.local/bin/weather-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 Weather database weekly
|
||||||
|
|
||||||
|
[Timer]
|
||||||
|
OnCalendar=weekly
|
||||||
|
Persistent=true
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=timers.target
|
||||||
@@ -57,5 +57,5 @@ Config { overrideRedirect = True
|
|||||||
]
|
]
|
||||||
, sepChar = "%"
|
, sepChar = "%"
|
||||||
, alignSep = "}{"
|
, alignSep = "}{"
|
||||||
, template = " | %UnsafeXMonadLog% } %uptime% | %multicpu% %coretemp% | %memory% | <action=`/home/fuxino/.config/xmobar/kbd_cycle.sh` button=1><action=`/home/fuxino/.config/xmobar/kbd_cycle.sh prev` button=3> %kbd%</action></action> { <action=`/home/fuxino/.config/xmobar/backup.sh list`>%backup%</action><action=`/home/fuxino/.config/xmobar/updates.sh list`>%updates%</action><action=`/home/fuxino/.config/xmobar/ens_brief.sh week`>%LZIB% <fc=#565f89>·</fc> %ens_brief%</action> | %pactl_volume% | <action=`gsimplecal`>%date%</action> "
|
, template = " | %UnsafeXMonadLog% } %uptime% | %multicpu% %coretemp% | %memory% | <action=`/home/fuxino/.config/xmobar/kbd_cycle.sh` button=1><action=`/home/fuxino/.config/xmobar/kbd_cycle.sh prev` button=3> %kbd%</action></action> { <action=`/home/fuxino/.config/xmobar/backup.sh list`>%backup%</action><action=`/home/fuxino/.config/xmobar/updates.sh list`>%updates%</action><action=`/home/fuxino/.config/xmobar/ens_brief.sh week`>%LZIB% <fc=#565f89>·</fc> %ens_brief%</action> | %pactl_volume% | <action=`env GDK_DPI_SCALE=1.25 gsimplecal`>%date%</action> "
|
||||||
}
|
}
|
||||||
@@ -58,5 +58,5 @@ Config { overrideRedirect = True
|
|||||||
]
|
]
|
||||||
, sepChar = "%"
|
, sepChar = "%"
|
||||||
, alignSep = "}{"
|
, alignSep = "}{"
|
||||||
, template = " | %UnsafeXMonadLog% } %uptime% | %multicpu% %coretemp% | %memory% | <action=`/home/fuxino/.config/xmobar/kbd_cycle.sh` button=1><action=`/home/fuxino/.config/xmobar/kbd_cycle.sh prev` button=3> %kbd%</action></action> { <action=`/home/fuxino/.config/xmobar/backup.sh list`>%backup%</action><action=`/home/fuxino/.config/xmobar/updates.sh list`>%updates%</action><action=`/home/fuxino/.config/xmobar/ens_brief.sh week`>%LZIB% <fc=#565f89>·</fc> %ens_brief%</action> | %pactl_volume% | <action=`gsimplecal`>%date%</action> %_XMONAD_TRAYPAD% "
|
, template = " | %UnsafeXMonadLog% } %uptime% | %multicpu% %coretemp% | %memory% | <action=`/home/fuxino/.config/xmobar/kbd_cycle.sh` button=1><action=`/home/fuxino/.config/xmobar/kbd_cycle.sh prev` button=3> %kbd%</action></action> { <action=`/home/fuxino/.config/xmobar/backup.sh list`>%backup%</action><action=`/home/fuxino/.config/xmobar/updates.sh list`>%updates%</action><action=`/home/fuxino/.config/xmobar/ens_brief.sh week`>%LZIB% <fc=#565f89>·</fc> %ens_brief%</action> | %pactl_volume% | <action=`env GDK_DPI_SCALE=1.25 gsimplecal`>%date%</action> %_XMONAD_TRAYPAD% "
|
||||||
}
|
}
|
||||||
+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 |
|
| Audio / media | mpd, ncmpcpp, mpDris2, mpv, beets, pipewire |
|
||||||
| Packaging | `.config/aurutils-makepkg.conf`, `.config/aurb/`, `.local/bin/aurb` / `aurs` (aurutils wrappers) |
|
| Packaging | `.config/aurutils-makepkg.conf`, `.config/aurb/`, `.local/bin/aurb` / `aurs` (aurutils wrappers) |
|
||||||
| Services | `.config/systemd/user/` (timers and overrides) |
|
| Services | `.config/systemd/user/` (timers and overrides) |
|
||||||
| Scripts | `.local/bin/` (screen layout, phone mount, video helpers, Library and Garmin database dumps) |
|
| Scripts | `.local/bin/` (screen layout, phone mount, video helpers, Library, Garmin and Weather database dumps) |
|
||||||
|
|
||||||
Note: `config.fish` sources `~/.bash_aliases`, so the aliases apply in both shells.
|
Note: `config.fish` sources `~/.bash_aliases`, so the aliases apply in both shells.
|
||||||
|
|
||||||
|
|||||||
Executable
+24
@@ -0,0 +1,24 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# Dump the Weather database (ens-forecast) to a per-ISO-week file, keeping the two newest weeks.
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
cnf=${XDG_CONFIG_HOME:-$HOME/.config}/ens-forecast/dump.cnf
|
||||||
|
dir=${XDG_DATA_HOME:-$HOME/.local/share}/ens-forecast/dumps
|
||||||
|
out=$dir/Weather-$(date +%G-W%V).sql.gz
|
||||||
|
keep=2
|
||||||
|
|
||||||
|
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 Weather | gzip > "$tmp"
|
||||||
|
mv "$tmp" "$out"
|
||||||
|
|
||||||
|
# Names sort by week, so all but the last $keep are the old ones
|
||||||
|
dumps=("$dir"/Weather-*.sql.gz)
|
||||||
|
if (( ${#dumps[@]} > keep )); then
|
||||||
|
rm -f -- "${dumps[@]:0:${#dumps[@]}-keep}"
|
||||||
|
fi
|
||||||
Reference in new issue
Block a user