Moves binaries for use with gnu stow
This commit is contained in:
parent
f528ba793c
commit
4fd9f4809b
89 changed files with 0 additions and 0 deletions
29
bin/.bin/backup
Executable file
29
bin/.bin/backup
Executable file
|
@ -0,0 +1,29 @@
|
|||
#!/usr/bin/bash
|
||||
|
||||
#Directory on the server to backup to
|
||||
BACKUPDIR='/mnt/TimeMachine/Backup-JH/backups/'
|
||||
LATEST=$(ssh officeServerJH ls ${BACKUPDIR} | sort | tail -n 1)
|
||||
TODAY=$(date -I -d "today")
|
||||
echo ${LATEST##*\/}
|
||||
echo ${TODAY}
|
||||
|
||||
#This can be tricked by having a folder with a date after the current date
|
||||
if [[ ${LATEST##*\/} = ${TODAY} ]]; then
|
||||
echo "There already seems to have been a backup today"
|
||||
echo "If you want to rename the folder ${LATEST} then run again"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
#Backup sites directory
|
||||
rsync --archive --one-file-system --hard-links --human-readable --inplace\
|
||||
--exclude-from=./backupExcludes\
|
||||
--link-dest=${BACKUPDIR}${LATEST}\
|
||||
~/Sites officeServerJH:/mnt/TimeMachine/Backup-JH/backups/${TODAY}/ --verbose
|
||||
|
||||
#Backup Documents Directory
|
||||
rsync --archive --one-file-system --hard-links --human-readable --inplace\
|
||||
--exclude-from=./backupExcludes\
|
||||
--link-dest=${BACKUPDIR}${LATEST}\
|
||||
~/Documents officeServerJH:/mnt/TimeMachine/Backup-JH/backups/${TODAY}/ --verbose
|
||||
|
||||
#At some point, add ability to delete old backups
|
Loading…
Add table
Add a link
Reference in a new issue