Skip to content

Instantly share code, notes, and snippets.

@joeperpetua
Created August 17, 2023 16:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save joeperpetua/8bfce702b73c574dc9cafa47f920bc76 to your computer and use it in GitHub Desktop.
Save joeperpetua/8bfce702b73c574dc9cafa47f920bc76 to your computer and use it in GitHub Desktop.
Auto resume Hyper Backup task
#!/bin/sh
TASK_ID=3;
TASK_STATUS=$(synowebapi --exec api=SYNO.Backup.Task method=status version=1 task_id="$TASK_ID" additional='["last_bkp_result"]' | jq .data.last_bkp_result);
if [[ "$TASK_STATUS" == \"suspend\" ]]; then
echo "[$(date)] Backup is suspended" >> /volume1/hb_auto_resume.log;
echo "[$(date)] Resuming backup..." >> /volume1/hb_auto_resume.log;
synowebapi --exec api=SYNO.Backup.Task method=resume task_id="$TASK_ID" version=1 >> /volume1/hb_auto_resume.log;
else
echo "[$(date)] Backup is not suspended." >> /volume1/hb_auto_resume.log;
echo "[$(date)] Do nothing until next run..." >> /volume1/hb_auto_resume.log;
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment