mirror of
https://github.com/SinTan1729/random.git
synced 2024-12-26 05:08:36 -06:00
76 lines
5.6 KiB
Bash
76 lines
5.6 KiB
Bash
#!/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.lock" "$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 -f '- *.git/' -f '- *Rust/*/target/' "$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 "NOW SYNCING UP WITH THE SERVER" | tee -a "$HMDIR/TempStorage/impfilesbk.log"
|
|
echo "--------------------------------------------------" | tee -a "$HMDIR/TempStorage/impfilesbk.log"
|
|
|
|
HMDIR="/mnt/storage/sintan"
|
|
BKDIR="server-rsync:/mnt/storage"
|
|
LGDIR="/home/sintan"
|
|
|
|
rsync -aAXH --delete --stats "$BKDIR/Documents/Backup/pkglists_server/" "$HMDIR/Documents/Backup/pkglists_server/" | tee -a "$LGDIR/TempStorage/impfilesbk.log"
|
|
rsync -aAXH --delete --stats "$HMDIR/Documents/Backup/pkglists_server/" "$LGDIR/Documents/Backup/pkglists_server/" | tee -a "$LGDIR/TempStorage/impfilesbk.log"
|
|
rsync -aAXH --delete --stats "$HMDIR/Documents/" "$BKDIR/Documents/" | tee -a "$LGDIR/TempStorage/impfilesbk.log"
|
|
rsync -aAXH --delete --stats "$HMDIR/Academics/" "$BKDIR/Academics/" | tee -a "$LGDIR/TempStorage/impfilesbk.log"
|
|
rsync -aAXH --delete --stats --no-links "$HMDIR/Pictures/" "$BKDIR/Pictures/" | tee -a "$LGDIR/TempStorage/impfilesbk.log"
|
|
rsync -aAXH --delete --stats "$HMDIR/Zotero/" "$BKDIR/Zotero/" | tee -a "$LGDIR/TempStorage/impfilesbk.log"
|
|
rsync -aAXH --delete --stats "$HMDIR/dotfiles/" "$BKDIR/dotfiles/" | tee -a "$LGDIR/TempStorage/impfilesbk.log"
|
|
rsync -aAXH --delete --stats "$BKDIR/dotfiles_server/" "$HMDIR/dotfiles_server/" | tee -a "$LGDIR/TempStorage/impfilesbk.log"
|
|
rsync -aAXH --delete --stats "$BKDIR/Programs/Docker/" "$HMDIR/Programs/Docker/" | tee -a "$LGDIR/TempStorage/impfilesbk.log"
|
|
rsync -aAXH --delete --stats "$BKDIR/Programs/installer-scripts/" "$HMDIR/Programs/installer-scripts/" | tee -a "$LGDIR/TempStorage/impfilesbk.log"
|
|
rsync -aAXH --delete --stats "$HMDIR/Programs/" "$BKDIR/Programs/" | tee -a "$LGDIR/TempStorage/impfilesbk.log"
|
|
rsync -aAXH --delete --stats "$BKDIR/Movies/" "$HMDIR/Movies/" | tee -a "$LGDIR/TempStorage/impfilesbk.log"
|
|
rsync -aAXH --delete --stats "$HMDIR/Music/" "$BKDIR/Music/" | tee -a "$LGDIR/TempStorage/impfilesbk.log"
|
|
rsync -aAXH --delete --stats "$HMDIR/Videos/" "$BKDIR/Videos/" | tee -a "$LGDIR/TempStorage/impfilesbk.log"
|
|
|
|
echo $'\n'"--------------------------------------------------" | tee -a "$LGDIR/TempStorage/impfilesbk.log"
|
|
echo "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" | tee -a "$LGDIR/TempStorage/impfilesbk.log"
|
|
echo "--------------------------------------------------" | tee -a "$LGDIR/TempStorage/impfilesbk.log"
|