#!/bin/sh # This script backs up some important stuff # Run only one instance of this script at one time [ "${BKLOCKER}" != "running" ] && exec env BKLOCKER="running" flock -en "/tmp/impfilesbk" "$0" "$@" || : # Setup location for home and backup directory HMDIR="/home/sintan" BKDIR="/mnt/storage/sintan" echo `date` "| Backing up Documents..." | tee -a "$HMDIR/TempStorage/impfilesbk.log" rsync -aAXH --delete --stats "$HMDIR/Documents/" "$BKDIR/Documents/" | tee -a "$HMDIR/TempStorage/impfilesbk.log" echo $'\n'`date` "| Done!" | tee -a "$HMDIR/TempStorage/impfilesbk.log" echo "--------------------------------------------------" | tee -a "$HMDIR/TempStorage/impfilesbk.log" echo `date` "| Backing up Academics..." | tee -a "$HMDIR/TempStorage/impfilesbk.log" rsync -aAXH --delete --stats "$HMDIR/Academics/" "$BKDIR/Academics/" | tee -a "$HMDIR/TempStorage/impfilesbk.log" echo $'\n'`date` "| Done!" | tee -a "$HMDIR/TempStorage/impfilesbk.log" echo "--------------------------------------------------" | tee -a "$HMDIR/TempStorage/impfilesbk.log" echo `date` "| Backing up Pictures..." | tee -a "$HMDIR/TempStorage/impfilesbk.log" rsync -aAXH --delete --stats "$HMDIR/Pictures/" "$BKDIR/Pictures/" | tee -a "$HMDIR/TempStorage/impfilesbk.log" echo $'\n'`date` "| Done!" | tee -a "$HMDIR/TempStorage/impfilesbk.log" echo "--------------------------------------------------" | tee -a "$HMDIR/TempStorage/impfilesbk.log" echo `date` "| Backing up PhotoPrism index..." | tee -a "$HMDIR/TempStorage/impfilesbk.log" rsync -aAXH --delete --stats "$HMDIR/PhotoPrism/storage/index-backup.sql" "$BKDIR/Programs/photoprism-backup.sql" | tee -a "$HMDIR/TempStorage/impfilesbk.log" echo $'\n'`date` "| Done!" | tee -a "$HMDIR/TempStorage/impfilesbk.log" echo "--------------------------------------------------" | tee -a "$HMDIR/TempStorage/impfilesbk.log" echo `date` "| Backing up Zotero..." | tee -a "$HMDIR/TempStorage/impfilesbk.log" rsync -aAXH --delete --stats "$HMDIR/Zotero/" "$BKDIR/Zotero/" | tee -a "$HMDIR/TempStorage/impfilesbk.log" echo $'\n'`date` "| Done!" | tee -a "$HMDIR/TempStorage/impfilesbk.log" echo "--------------------------------------------------" | tee -a "$HMDIR/TempStorage/impfilesbk.log" echo `date` "| Backing up some dotfiles..." | tee -a "$HMDIR/TempStorage/impfilesbk.log" rsync -aAXH --delete --stats --quiet --no-links --exclude={'*cache*','*Cache*'} --delete-excluded "$HMDIR/.config/" "$BKDIR/dotfiles/[dot]config/" | tee -a "$HMDIR/TempStorage/impfilesbk.log" rsync -aAXH --delete --stats "$HMDIR/.profile" "$BKDIR/dotfiles/[dot]profile" | tee -a "$HMDIR/TempStorage/impfilesbk.log" rsync -aAXH --delete --stats "$HMDIR/.bashrc" "$BKDIR/dotfiles/[dot]bashrc" | tee -a "$HMDIR/TempStorage/impfilesbk.log" rsync -aAXH --delete --stats "$HMDIR/.Xresources" "$BKDIR/dotfiles/[dot]Xresources" | tee -a "$HMDIR/TempStorage/impfilesbk.log" rsync -aAXH --delete --stats "$HMDIR/.local/bin/personal/" "$BKDIR/dotfiles/[dot]local_bin_personal/" | tee -a "$HMDIR/TempStorage/impfilesbk.log" rsync -aAXH --delete --stats "$HMDIR/.ssh/" "$BKDIR/dotfiles/[dot]ssh/" | tee -a "$HMDIR/TempStorage/impfilesbk.log" echo $'\n'`date` "| Done!" | tee -a "$HMDIR/TempStorage/impfilesbk.log" echo $'\n'"--------------------------------------------------" | tee -a "$HMDIR/TempStorage/impfilesbk.log" echo "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" | tee -a "$HMDIR/TempStorage/impfilesbk.log" echo "--------------------------------------------------" | tee -a "$HMDIR/TempStorage/impfilesbk.log"