1
0
Fork 0
mirror of https://github.com/SinTan1729/random.git synced 2024-12-25 04:48:37 -06:00
random/impfilesbk_server

91 lines
5.9 KiB
Text
Raw Normal View History

2022-09-17 22:09:13 -05:00
#!/bin/sh
# This script backs up some important stuff
# This is the version for my home server
# force script to run as specific user
if [ "$(id -u)" -eq 0 ]; then
exec sudo -H -u sintan $0 "$@"
fi
# Exit the whole script when ctrl+c is pressed
set -e
2022-09-17 22:09:13 -05:00
# 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"
2023-06-27 19:36:54 -05:00
echo $(date) "| Backing up PhotoPrism index..." | tee -a "$BKDIR/TempStorage/impfilesbk.log"
2022-12-14 18:01:05 -06:00
rsync -aAXH --delete --stats "$HMDIR/Docker/photoprism/storage/index-backup.sql" "$BKDIR/Programs/Docker/PhotoPrism/index-backup-"$(date +%A)".sql" | tee -a "$BKDIR/TempStorage/impfilesbk.log"
2023-06-27 19:36:54 -05:00
echo $'\n'$(date) "| Done!" | tee -a "$BKDIR/TempStorage/impfilesbk.log"
2022-09-17 22:09:13 -05:00
echo "--------------------------------------------------" | tee -a "$BKDIR/TempStorage/impfilesbk.log"
2023-06-27 19:36:54 -05:00
echo $(date) "| Backing up arr index..." | tee -a "$BKDIR/TempStorage/impfilesbk.log"
2022-12-14 18:04:26 -06:00
rsync -aAXH --delete --stats "$HMDIR/Docker/arr/config_sonarr/Backups/" "$BKDIR/Programs/Docker/arr-backups/sonarr/" | tee -a "$BKDIR/TempStorage/impfilesbk.log"
rsync -aAXH --delete --stats "$HMDIR/Docker/arr/config_prowlarr/Backups/" "$BKDIR/Programs/Docker/arr-backups/prowlarr/" | tee -a "$BKDIR/TempStorage/impfilesbk.log"
2023-06-27 19:36:54 -05:00
echo $'\n'$(date) "| Done!" | tee -a "$BKDIR/TempStorage/impfilesbk.log"
2022-09-17 22:09:13 -05:00
2023-07-08 15:05:44 -05:00
echo "--------------------------------------------------" | tee -a "$BKDIR/TempStorage/impfilesbk.log"
2023-06-27 19:36:54 -05:00
echo $(date) "| Backing up qBittorrent config..." | tee -a "$BKDIR/TempStorage/impfilesbk.log"
2024-07-15 21:59:28 -05:00
rsync -aAXH --delete --stats "$HMDIR/Docker/qbt/qbt-config/" "$BKDIR/Programs/Docker/qBittorrent-config/" | tee -a "$BKDIR/TempStorage/impfilesbk.log"
rsync -aAXH --delete --stats "$HMDIR/Docker/qbt-private/qbt-config/" "$BKDIR/Programs/Docker/qBittorrent2-config/" | tee -a "$BKDIR/TempStorage/impfilesbk.log"
2023-06-27 19:36:54 -05:00
echo $'\n'$(date) "| Done!" | tee -a "$BKDIR/TempStorage/impfilesbk.log"
2022-12-15 17:12:35 -06:00
2022-09-17 22:09:13 -05:00
echo "--------------------------------------------------" | tee -a "$BKDIR/TempStorage/impfilesbk.log"
2024-10-01 12:29:20 -05:00
echo $(date) "| Backing up Caddyfiles..." | tee -a "$BKDIR/TempStorage/impfilesbk.log"
rsync -aAXH --delete --stats "$HMDIR/Docker/caddy/Caddyfiles/" "$BKDIR/Programs/Docker/Caddyfiles/" | tee -a "$BKDIR/TempStorage/impfilesbk.log"
2023-07-24 15:43:12 -05:00
echo $'\n'$(date) "| Done!" | tee -a "$BKDIR/TempStorage/impfilesbk.log"
echo "--------------------------------------------------" | tee -a "$BKDIR/TempStorage/impfilesbk.log"
2024-02-26 19:00:08 -06:00
echo $(date) "| Backing up cloudfalred config..." | tee -a "$BKDIR/TempStorage/impfilesbk.log"
2023-09-14 22:44:20 -05:00
rsync -aAXH --delete --stats "$HMDIR/Docker/cloudflared/config/" "$BKDIR/Programs/Docker/cloudflared-config/" | tee -a "$BKDIR/TempStorage/impfilesbk.log"
echo $'\n'$(date) "| Done!" | tee -a "$BKDIR/TempStorage/impfilesbk.log"
2024-02-26 19:00:08 -06:00
echo $(date) "| Backing up gpodder2go config..." | tee -a "$BKDIR/TempStorage/impfilesbk.log"
2024-06-04 17:08:28 -05:00
rsync -aAXH --delete --stats "$HMDIR/Docker/gpodder/data/" "$BKDIR/Programs/Docker/gpodder2go-data/" | tee -a "$BKDIR/TempStorage/impfilesbk.log"
2024-02-26 19:00:08 -06:00
echo $'\n'$(date) "| Done!" | tee -a "$BKDIR/TempStorage/impfilesbk.log"
2023-09-14 22:44:20 -05:00
echo "--------------------------------------------------" | tee -a "$BKDIR/TempStorage/impfilesbk.log"
2023-07-08 15:05:44 -05:00
echo $(date) "| Backing up Jellyfin config..." | tee -a "$BKDIR/TempStorage/impfilesbk.log"
rsync -aAXH --delete --stats "$HMDIR/Docker/jellyfin/config/" "$BKDIR/Programs/Docker/jellyfin-config/" | tee -a "$BKDIR/TempStorage/impfilesbk.log"
echo $'\n'$(date) "| Done!" | tee -a "$BKDIR/TempStorage/impfilesbk.log"
echo "--------------------------------------------------" | tee -a "$BKDIR/TempStorage/impfilesbk.log"
2024-03-08 17:20:10 -06:00
echo $(date) "| Backing up Forgejo data..." | tee -a "$BKDIR/TempStorage/impfilesbk.log"
rsync -aAXH --delete --stats "$HMDIR/Docker/forgejo/*-data" "$BKDIR/Programs/Docker/forgejo/" | tee -a "$BKDIR/TempStorage/impfilesbk.log"
echo $'\n'$(date) "| Done!" | tee -a "$BKDIR/TempStorage/impfilesbk.log"
echo "--------------------------------------------------" | tee -a "$BKDIR/TempStorage/impfilesbk.log"
2023-06-27 19:36:54 -05:00
echo $(date) "| Backing up Docker compose files..." | tee -a "$BKDIR/TempStorage/impfilesbk.log"
rsync -aAXH --delete --stats --prune-empty-dirs -f '- /*/*/' "$HMDIR/Docker/" "$BKDIR/Programs/Docker/DockerCompose/" | tee -a "$BKDIR/TempStorage/impfilesbk.log"
echo $'\n'$(date) "| Done!" | tee -a "$BKDIR/TempStorage/impfilesbk.log"
echo "--------------------------------------------------" | tee -a "$BKDIR/TempStorage/impfilesbk.log"
echo $(date) "| Backing up some dotfiles..." | tee -a "$BKDIR/TempStorage/impfilesbk.log"
2022-09-17 22:09:13 -05:00
rsync -aAXH --delete --stats --quiet --no-links --exclude={'*cache*','*Cache*'} --delete-excluded "$HMDIR/.config/" "$BKDIR/dotfiles_server/[dot]config/" | tee -a "$BKDIR/TempStorage/impfilesbk.log"
rsync -aAXH --delete --stats "$HMDIR/.bash_profile" "$BKDIR/dotfiles_server/[dot]bash_profile" | tee -a "$BKDIR/TempStorage/impfilesbk.log"
rsync -aAXH --delete --stats "$HMDIR/.bashrc" "$BKDIR/dotfiles_server/[dot]bashrc" | tee -a "$BKDIR/TempStorage/impfilesbk.log"
# rsync -aAXH --delete --stats "$HMDIR/.Xresources" "$BKDIR/dotfiles_server/[dot]Xresources" | tee -a "$BKDIR/TempStorage/impfilesbk.log"
2022-11-23 21:35:06 -06:00
# rsync -aAXH --delete --stats "$BKDIR/dotfiles/[dot]local_bin_personal/" "$HMDIR/.local/bin/personal/" | tee -a "$BKDIR/TempStorage/impfilesbk.log"
2022-09-17 22:09:13 -05:00
rsync -aAXH --delete --stats "$HMDIR/.ssh/" "$BKDIR/dotfiles_server/[dot]ssh/" | tee -a "$BKDIR/TempStorage/impfilesbk.log"
2023-06-27 19:36:54 -05:00
echo $'\n'$(date) "| Done!" | tee -a "$BKDIR/TempStorage/impfilesbk.log"
2022-09-17 22:09:13 -05:00
echo $'\n'"--------------------------------------------------" | tee -a "$BKDIR/TempStorage/impfilesbk.log"
echo "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" | tee -a "$BKDIR/TempStorage/impfilesbk.log"
echo "--------------------------------------------------" | tee -a "$BKDIR/TempStorage/impfilesbk.log"
# Make the new files visible over samba
chcon -R -t samba_share_t /mnt/storage/Programs/
2023-06-27 19:36:54 -05:00
chcon -R -t samba_share_t /mnt/storage/dotfiles_server/