feat: install daily backup systemd timer from start.sh #2
1 changed files with 33 additions and 0 deletions
|
|
@ -217,3 +217,36 @@ UNIT
|
|||
systemctl --user daemon-reload
|
||||
systemctl --user enable --now hiy-update.timer
|
||||
echo "[hiy] Auto-update timer installed: systemctl --user status hiy-update.timer"
|
||||
|
||||
# ── Install systemd timer for daily backup ────────────────────────────────────
|
||||
BACKUP_SERVICE="$SERVICE_DIR/hiy-backup.service"
|
||||
BACKUP_TIMER="$SERVICE_DIR/hiy-backup.timer"
|
||||
|
||||
cat > "$BACKUP_SERVICE" <<UNIT
|
||||
[Unit]
|
||||
Description=HIY daily backup
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
Environment=PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/home/$(id -un)/.local/bin
|
||||
ExecStart=${SCRIPT_DIR}/backup.sh
|
||||
StandardOutput=journal
|
||||
StandardError=journal
|
||||
UNIT
|
||||
|
||||
cat > "$BACKUP_TIMER" <<UNIT
|
||||
[Unit]
|
||||
Description=HIY daily backup at 03:00
|
||||
|
||||
[Timer]
|
||||
OnCalendar=*-*-* 03:00:00
|
||||
Persistent=true
|
||||
Unit=hiy-backup.service
|
||||
|
||||
[Install]
|
||||
WantedBy=timers.target
|
||||
UNIT
|
||||
|
||||
systemctl --user daemon-reload
|
||||
systemctl --user enable --now hiy-backup.timer
|
||||
echo "[hiy] Backup timer installed: systemctl --user status hiy-backup.timer"
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue