annotate backup-to-disk @ 22:faa17dcc2c95

Make a compromise when backing up to external HDD Backups are getting bigger and space is getting short!
author IBBoard <dev@ibboard.co.uk>
date Sun, 09 Jun 2019 15:52:35 +0100
parents e85e3470a41e
children c7621908cb47
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
e85e3470a41e Initial commit of useful scripts
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1 #! /bin/bash -e
e85e3470a41e Initial commit of useful scripts
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
2
e85e3470a41e Initial commit of useful scripts
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
3 DISK=/run/media/ibboard/backup-linux/
e85e3470a41e Initial commit of useful scripts
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
4
e85e3470a41e Initial commit of useful scripts
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
5 if [ ! -d "$DISK" ]; then
e85e3470a41e Initial commit of useful scripts
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
6 echo "Disk not found at $DISK!" >&2
e85e3470a41e Initial commit of useful scripts
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
7 exit 1
e85e3470a41e Initial commit of useful scripts
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
8 fi
e85e3470a41e Initial commit of useful scripts
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
9
e85e3470a41e Initial commit of useful scripts
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
10 cp "$(ls -1 /mnt/backup/rsync/installed-packages-*|tail -n1)" "$DISK"
e85e3470a41e Initial commit of useful scripts
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
11 rm "$(ls -1 "$DISK"/installed-packages-* | head -n1)"
e85e3470a41e Initial commit of useful scripts
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
12 rm -rf $DISK/backup-prev
e85e3470a41e Initial commit of useful scripts
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
13 if [ -d "$DISK"/backup ]; then
e85e3470a41e Initial commit of useful scripts
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
14 mv $DISK/backup{,-prev}
e85e3470a41e Initial commit of useful scripts
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
15 fi
e85e3470a41e Initial commit of useful scripts
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
16 mkdir $DISK/backup
22
faa17dcc2c95 Make a compromise when backing up to external HDD
IBBoard <dev@ibboard.co.uk>
parents: 0
diff changeset
17
faa17dcc2c95 Make a compromise when backing up to external HDD
IBBoard <dev@ibboard.co.uk>
parents: 0
diff changeset
18 # Sacrifice the Windows game installers to free up space
faa17dcc2c95 Make a compromise when backing up to external HDD
IBBoard <dev@ibboard.co.uk>
parents: 0
diff changeset
19 # We should be fine, but it everything fails between now
faa17dcc2c95 Make a compromise when backing up to external HDD
IBBoard <dev@ibboard.co.uk>
parents: 0
diff changeset
20 # and backup completion then they're big but least important
faa17dcc2c95 Make a compromise when backing up to external HDD
IBBoard <dev@ibboard.co.uk>
parents: 0
diff changeset
21 rm -rf $DISK/backup-prev/media/Downloads/games/Windows
faa17dcc2c95 Make a compromise when backing up to external HDD
IBBoard <dev@ibboard.co.uk>
parents: 0
diff changeset
22
0
e85e3470a41e Initial commit of useful scripts
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
23 /usr/local/bin/do-backup "$DISK"/backup/
e85e3470a41e Initial commit of useful scripts
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
24