Archive abandoned project

This commit is contained in:
Benoit 2025-02-15 00:56:26 +09:00
parent bc8862d90b
commit 65be894048
501 changed files with 24305 additions and 0 deletions

View file

@ -0,0 +1,25 @@
#!/usr/bin/env bash
# https://serverfault.com/questions/538978/how-to-run-a-command-once-a-zfs-scrub-completes
set -euo pipefail
<% unless @hc_url.nil? %>
curl -m 10 --retry 5 <%= @hc_url %>/start
<% end %>
<% @pools.each_key do |pool| %>
zpool scrub <%= pool %>
# Wait until scrub for <%= pool %> is finished
while zpool status <%= pool %> | grep -q 'scan: *scrub in progress'; do
zpool status <%= pool %>
sleep 600
done
<% end %>
# Get status for all pools
zpool status
# Get stdout from journalctl
<% unless @hc_url.nil? %>
LOG=$(journalctl -o cat -u zfs-scrub.service -n 100)
curl -fsS -m 10 --retry 5 --data-raw "$LOG" <%= @hc_url %>
<% end %>
exit 0