dotfiles/backups/cron/hourly.sh

20 lines
1.2 KiB
Bash
Raw Normal View History

2024-03-14 17:19:26 +00:00
#!/bin/bash
2024-03-10 17:59:18 +00:00
2024-03-14 17:19:26 +00:00
USER=thomas
export XDG_RUNTIME_DIR=/run/user/1000
2024-03-10 17:59:18 +00:00
2024-03-14 17:19:26 +00:00
if mountpoint -q /media/backups; then
sudo /usr/bin/rsnapshot hourly
2024-03-28 16:05:30 +00:00
# sudo chown -R thomas:thomas /media/backups
2024-03-14 17:19:26 +00:00
# Check the exit status of the rsnapshot command
if [ $? -eq 0 ]; then
/usr/bin/notify-send 'rsync' 'Hourly backup completed successfully'
else
/usr/bin/notify-send -u critical 'rsync' 'Hourly backup failed'
fi
2024-03-10 17:59:18 +00:00
else
2024-03-14 17:19:26 +00:00
echo "Backup drive not mounted"
/usr/bin/notify-send -u critical 'Backup' 'Error: backup drive not mounted'
2024-03-10 17:59:18 +00:00
fi