Added script to check OS. Modified backup logic to look for mount dir based on OS
This commit is contained in:
parent
9685dfafbb
commit
c8aff9beec
2 changed files with 25 additions and 1 deletions
6
check_os.sh
Executable file
6
check_os.sh
Executable file
|
|
@ -0,0 +1,6 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Check what OS we're on
|
||||||
|
OS=`awk -F = '/^NAME/{print $2}' /etc/os-release`
|
||||||
|
echo "OS found in /etc/os-release is $OS"
|
||||||
|
export OS="$OS"
|
||||||
|
|
@ -3,11 +3,29 @@
|
||||||
#Script to back up /home/tracey to external USB drive
|
#Script to back up /home/tracey to external USB drive
|
||||||
#http://www.bobulous.org.uk/misc/rsync-backup.html
|
#http://www.bobulous.org.uk/misc/rsync-backup.html
|
||||||
date=`date +%Y-%m-%d`
|
date=`date +%Y-%m-%d`
|
||||||
mount_point='/media/tracey/Backup'
|
|
||||||
log_file='/home/tracey/backuplogs/usb-rsync-backup-'${date}'.txt'
|
log_file='/home/tracey/backuplogs/usb-rsync-backup-'${date}'.txt'
|
||||||
|
|
||||||
echo "#####"
|
echo "#####"
|
||||||
echo ""
|
echo ""
|
||||||
|
|
||||||
|
# Check what OS we're on
|
||||||
|
# OS=`awk -F = '/NAME/{print $2}' /etc/os-release`
|
||||||
|
# echo "OS we're running on is $OS"
|
||||||
|
source ~/git/shell-scripts/check_os.sh
|
||||||
|
|
||||||
|
if [[ "$OS" =~ .*Solus.* ]]
|
||||||
|
then
|
||||||
|
echo "Setting mount point for Solus"
|
||||||
|
mount_point='/run/media/tracey/Backup'
|
||||||
|
elif [[ "$OS" = "Ubuntu" ]]
|
||||||
|
then
|
||||||
|
echo "Setting mount point for Ubuntu"
|
||||||
|
mount_point='/media/tracey/Backup'
|
||||||
|
else
|
||||||
|
echo "Unknown OS!"
|
||||||
|
fi
|
||||||
|
echo "Mount point is $mount_point"
|
||||||
|
|
||||||
# Check whether target volume is mounted, and mount it if not.
|
# Check whether target volume is mounted, and mount it if not.
|
||||||
if ! mountpoint -q ${mount_point}/; then
|
if ! mountpoint -q ${mount_point}/; then
|
||||||
echo "Mounting the external USB drive."
|
echo "Mounting the external USB drive."
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue