pull.sh (1930B)
1 #!/bin/bash 2 3 COMMON_EXCLUDES=( 4 --exclude='.cache/' 5 --exclude='.local/' 6 --exclude='node_modules/' 7 --exclude='__pycache__/' 8 --exclude='vms/' 9 --exclude='.venv/' 10 --exclude='venv/' 11 --exclude='BraveSoftware/' 12 --exclude='librewolf/' 13 --exclude='gitRepos/' # this is all versioned... 14 --exclude='venv/' 15 --exclude='personal-files' # already synced in another way. 16 # TODO: Why am I even backing anything up from homes? Shouldn't there be one 17 # sync directory (probably in /srv?) and then that has git repos + one dir for other stuff. 18 ) 19 20 backup-vps () { 21 # Website + blog + git stuff 22 mkdir -p /home/backup/vps/srv 23 rsync -v --delete --recursive root@laack.co:/srv/ /home/backup/vps/srv 24 25 # ? 26 mkdir -p /home/backup/vps/var 27 rsync -v --delete --recursive root@laack.co:/var/ /home/backup/vps/var 28 29 # Other configuration 30 mkdir -p /home/backup/vps/etc 31 rsync -v --delete --recursive root@laack.co:/etc/ /home/backup/vps/etc 32 } 33 34 shared-directories() { 35 # These are files that should be shared, source of truth is brgr 36 rsync -v --delete --recursive andrew@brgr:/home/andrew/personal-files ~ 37 } 38 39 backup-brgr() { 40 41 # These are private git repos 42 mkdir -p /home/backup/brgr/srv 43 rsync -v --delete --recursive andrew@brgr:/srv/ /home/backup/brgr/srv 44 45 # Home directory 46 mkdir -p /home/backup/brgr/home 47 rsync -v --delete --recursive "${COMMON_EXCLUDES[@]}" andrew@brgr:/home/andrew /home/backup/brgr/home 48 } 49 50 backup-deepthought() { 51 mkdir -p /home/backup/deepthought/home 52 rsync -v --delete --recursive "${COMMON_EXCLUDES[@]}" andrew@deepthought:/home/andrew /home/backup/deepthought/home 53 } 54 55 if [ -n "$(hostnamectl | grep deepthought)" ] ; then 56 backup-vps 57 backup-brgr 58 shared-directories 59 fi 60 61 # BRGR is source of truth for shared-directories 62 if [ -n "$(hostnamectl | grep brgr)" ] ; then 63 backup-vps 64 backup-deepthought 65 fi