dotfiles/backups/cron/home/hourly.sh

19 lines
560 B
Bash
Raw Permalink Normal View History

2025-04-06 15:37:42 +01:00
#!/bin/bash
2024-03-10 17:59:18 +00:00
2025-04-06 15:37:42 +01:00
THIS_FILE=${0}
SLACK_NOTIFIER="/home/thomas/dotfiles/scripts/slack_notifier.sh"
2024-03-14 17:19:26 +00:00
USER=thomas
export XDG_RUNTIME_DIR=/run/user/1000
source /home/thomas/.env
2024-03-14 17:19:26 +00:00
2025-04-06 15:37:42 +01:00
if mountpoint -q /media/samsung-T3; then
SNAPSHOT=$(sudo /usr/bin/rsnapshot -c /etc/rsnapshot.conf hourly 2>&1 1>/dev/null)
if [ $? -ne 0 ]; then
$SLACK_NOTIFIER "backups" "ERROR Hourly /home backup failed" "$SNAPSHOT"
else
$SLACK_NOTIFIER "backups" "SUCCESS Hourly /home backup completed."
fi
else
$SLACK_NOTIFIER "backups" "ERROR Hourly /home backup failed: disk not mounted."
2024-03-10 17:59:18 +00:00
fi