backups: improve cron scripts
This commit is contained in:
parent
5e5c8ce3d0
commit
130c3a5aee
5 changed files with 61 additions and 21 deletions
|
@ -1,9 +1,19 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
USER=thomas
|
||||||
|
export XDG_RUNTIME_DIR=/run/user/1000
|
||||||
|
|
||||||
|
|
||||||
|
if mountpoint -q /media/backups; then
|
||||||
sudo /usr/bin/rsnapshot daily
|
sudo /usr/bin/rsnapshot daily
|
||||||
|
sudo chown -R thomas:thomas /media/backups
|
||||||
sudo chown -R thomas:thomas /mnt/backups
|
# Check the exit status of the rsnapshot command
|
||||||
|
|
||||||
if [ $? -eq 0 ]; then
|
if [ $? -eq 0 ]; then
|
||||||
/usr/bin/notify-send 'Backup' 'Daily backup completed successfully'
|
/usr/bin/notify-send 'rsync' 'Daily backup completed successfully'
|
||||||
else
|
else
|
||||||
/usr/bin/notify-send 'Backup' 'Daily backup failed'
|
/usr/bin/notify-send -u critical 'rsync' 'Daily backup failed'
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo "Backup drive not mounted"
|
||||||
|
/usr/bin/notify-send -u critical 'Backup' 'Error: backup drive not mounted'
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -1,9 +1,19 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
USER=thomas
|
||||||
|
export XDG_RUNTIME_DIR=/run/user/1000
|
||||||
|
|
||||||
|
|
||||||
|
if mountpoint -q /media/backups; then
|
||||||
sudo /usr/bin/rsnapshot hourly
|
sudo /usr/bin/rsnapshot hourly
|
||||||
|
sudo chown -R thomas:thomas /media/backups
|
||||||
sudo chown -R thomas:thomas /mnt/backups
|
# Check the exit status of the rsnapshot command
|
||||||
|
|
||||||
if [ $? -eq 0 ]; then
|
if [ $? -eq 0 ]; then
|
||||||
/usr/bin/notify-send 'Backup' 'Hourly backup completed successfully'
|
/usr/bin/notify-send 'rsync' 'Hourly backup completed successfully'
|
||||||
else
|
else
|
||||||
/usr/bin/notify-send 'Backup' 'Hourly backup failed'
|
/usr/bin/notify-send -u critical 'rsync' 'Hourly backup failed'
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo "Backup drive not mounted"
|
||||||
|
/usr/bin/notify-send -u critical 'Backup' 'Error: backup drive not mounted'
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -1,9 +1,19 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
USER=thomas
|
||||||
|
export XDG_RUNTIME_DIR=/run/user/1000
|
||||||
|
|
||||||
|
|
||||||
|
if mountpoint -q /media/backups; then
|
||||||
sudo /usr/bin/rsnapshot monthly
|
sudo /usr/bin/rsnapshot monthly
|
||||||
|
sudo chown -R thomas:thomas /media/backups
|
||||||
sudo chown -R thomas:thomas /mnt/backups
|
# Check the exit status of the rsnapshot command
|
||||||
|
|
||||||
if [ $? -eq 0 ]; then
|
if [ $? -eq 0 ]; then
|
||||||
/usr/bin/notify-send 'Backup' 'Monthly backup completed successfully'
|
/usr/bin/notify-send 'rsync' 'Monthly backup completed successfully'
|
||||||
else
|
else
|
||||||
/usr/bin/notify-send 'Backup' 'Monthly backup failed'
|
/usr/bin/notify-send -u critical 'rsync' 'Monthly backup failed'
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo "Backup drive not mounted"
|
||||||
|
/usr/bin/notify-send -u critical 'Backup' 'Error: backup drive not mounted'
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -1,9 +1,19 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
USER=thomas
|
||||||
|
export XDG_RUNTIME_DIR=/run/user/1000
|
||||||
|
|
||||||
|
|
||||||
|
if mountpoint -q /media/backups; then
|
||||||
sudo /usr/bin/rsnapshot weekly
|
sudo /usr/bin/rsnapshot weekly
|
||||||
|
sudo chown -R thomas:thomas /media/backups
|
||||||
sudo chown -R thomas:thomas /mnt/backups
|
# Check the exit status of the rsnapshot command
|
||||||
|
|
||||||
if [ $? -eq 0 ]; then
|
if [ $? -eq 0 ]; then
|
||||||
/usr/bin/notify-send 'Backup' 'Weekly backup completed successfully'
|
/usr/bin/notify-send 'rsync' 'Weekly backup completed successfully'
|
||||||
else
|
else
|
||||||
/usr/bin/notify-send 'Backup' 'Weekly backup failed'
|
/usr/bin/notify-send -u critical 'rsync' 'Weekly backup failed'
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo "Backup drive not mounted"
|
||||||
|
/usr/bin/notify-send -u critical 'Backup' 'Error: backup drive not mounted'
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -21,7 +21,7 @@ config_version 1.2
|
||||||
# All snapshots will be stored under this root directory.
|
# All snapshots will be stored under this root directory.
|
||||||
#
|
#
|
||||||
|
|
||||||
snapshot_root /run/media/thomas/archbish_backups
|
snapshot_root /media/backups
|
||||||
# If no_create_root is enabled, rsnapshot will not automatically create the
|
# If no_create_root is enabled, rsnapshot will not automatically create the
|
||||||
# snapshot_root directory. This is particularly useful if you are backing
|
# snapshot_root directory. This is particularly useful if you are backing
|
||||||
# up to removable media, such as a FireWire or USB drive.
|
# up to removable media, such as a FireWire or USB drive.
|
||||||
|
|
Loading…
Add table
Reference in a new issue