tangled
alpha
login
or
join now
dunkirk.sh
/
dots
3
fork
atom
Kieran's opinionated (and probably slightly dumb) nix config
3
fork
atom
overview
issues
pulls
pipelines
feat: tail the backups
dunkirk.sh
2 months ago
d127dfa4
60523c9f
verified
This commit was signed with the committer's
known signature
.
dunkirk.sh
SSH Key Fingerprint:
SHA256:DqcG0RXYExE26KiWo3VxJnsxswN1QNfTBvB+bdSpk80=
+27
-2
1 changed file
expand all
collapse all
unified
split
modules
nixos
services
restic
cli.nix
+27
-2
modules/nixos/services/restic/cli.nix
···
135
135
if [ "$svc" = "all" ]; then
136
136
for s in $SERVICES; do
137
137
style --foreground 117 "Backing up $s..."
138
138
-
systemctl start "restic-backups-$s.service" || style --foreground 214 "! Failed to backup $s"
138
138
+
systemctl start "restic-backups-$s.service"
139
139
+
journalctl -u "restic-backups-$s.service" -f -n 0 --output=cat &
140
140
+
journal_pid=$!
141
141
+
while systemctl is-active --quiet "restic-backups-$s.service"; do
142
142
+
sleep 1
143
143
+
done
144
144
+
kill $journal_pid 2>/dev/null || true
145
145
+
if systemctl is-failed --quiet "restic-backups-$s.service"; then
146
146
+
style --foreground 214 "! Failed to backup $s"
147
147
+
else
148
148
+
style --foreground 35 "✓ $s complete"
149
149
+
fi
150
150
+
echo
139
151
done
140
152
else
141
153
style --foreground 117 "Backing up $svc..."
142
154
systemctl start "restic-backups-$svc.service"
155
155
+
journalctl -u "restic-backups-$svc.service" -f -n 0 --output=cat &
156
156
+
journal_pid=$!
157
157
+
while systemctl is-active --quiet "restic-backups-$svc.service"; do
158
158
+
sleep 1
159
159
+
done
160
160
+
kill $journal_pid 2>/dev/null || true
143
161
fi
144
162
145
145
-
style --foreground 35 "✓ Backup triggered"
163
163
+
if [ "$svc" != "all" ]; then
164
164
+
if systemctl is-failed --quiet "restic-backups-$svc.service"; then
165
165
+
style --foreground 196 "✗ Backup failed"
166
166
+
exit 1
167
167
+
else
168
168
+
style --foreground 35 "✓ Backup complete"
169
169
+
fi
170
170
+
fi
146
171
}
147
172
148
173
cmd_restore() {