Pause backup scheduling and atomically deploy workstation updates

This commit is contained in:
admin committed 2026-10-26 12:38:11 +01:00
1 parent 8245571f15
commit a1a843a6f7
4 files changed
+39 -6

No files matched your search

+12 -4
View File
@@ -20,9 +20,6 @@ EXISTING_CONFIG=false
mkdir -p "${HOME}/.local/libexec" "$BIN_DIR" "$CONFIG_DIR" "$STATE_DIR/logs" "$SYSTEMD_USER_DIR"
install -m 0750 "$ROOT_DIR/scripts/nextcloud-borg-runner.py" "${HOME}/.local/libexec/nextcloud-borg-runner.py"
install -m 0750 "$ROOT_DIR/scripts/nextcloud-borg-backup" "$BIN_DIR/nextcloud-borg-backup"
if [[ ! -f "$CONFIG_DIR/config" ]]; then
install -m 0600 "$ROOT_DIR/etc/config.example" "$CONFIG_DIR/config"
printf 'Installed config: %s\n' "$CONFIG_DIR/config"
@@ -60,8 +57,19 @@ if [[ ! -f "$KEY_PATH" ]]; then
printf 'Store a copy of this passphrase somewhere safe for disaster recovery.\n'
fi
# Prevent a pending timer event from starting between replacing wrapper and runner.
if systemctl --user cat nextcloud-borg-backup.service >/dev/null 2>&1; then
systemctl --user stop nextcloud-borg-backup.service nextcloud-borg-backup.timer
fi
atomic_install() {
install -m "$3" "$1" "$2.new"
mv -f "$2.new" "$2"
}
atomic_install "$ROOT_DIR/scripts/nextcloud-borg-runner.py" "${HOME}/.local/libexec/nextcloud-borg-runner.py" 0750
atomic_install "$ROOT_DIR/scripts/nextcloud-borg-backup" "$BIN_DIR/nextcloud-borg-backup" 0750
for unit in nextcloud-borg-backup.service nextcloud-borg-backup.timer nextcloud-borg-health.service nextcloud-borg-health.timer; do
install -m 0644 "$ROOT_DIR/systemd/user/$unit" "$SYSTEMD_USER_DIR/$unit"
atomic_install "$ROOT_DIR/systemd/user/$unit" "$SYSTEMD_USER_DIR/$unit" 0644
done
systemctl --user daemon-reload
systemctl --user enable nextcloud-borg-backup.timer nextcloud-borg-health.timer
+1
View File
@@ -400,6 +400,7 @@ def main():
sys.stdout = Tee()
# Child output goes to journal; lifecycle/phase/status additionally go to the run log.
try:
log('Verified cloud-to-NAS runner 2.0.0, revision 3')
runner.backup('--if-due' in sys.argv)
finally:
sys.stdout = sys.__stdout__