diff options
author | Xiao Pan <gky44px1999@gmail.com> | 2024-04-21 22:13:17 -0700 |
---|---|---|
committer | Xiao Pan <gky44px1999@gmail.com> | 2024-04-21 22:13:17 -0700 |
commit | 0c40e003145789e027e69f51425ac4201f369d58 (patch) | |
tree | a5ed25d94d4105790269db8f45877ccf3b427d0f | |
parent | 9e7482a1d28dd912847b8afc9a3cb71288bba8f7 (diff) |
remove ka vps
-rwxr-xr-x | sh/sbar | 1 | ||||
-rwxr-xr-x | sh/u | 2 | ||||
-rwxr-xr-x | sh/upd | 23 | ||||
-rwxr-xr-x | sh/vip | 5 | ||||
-rwxr-xr-x | sh/vpn | 2 |
5 files changed, 13 insertions, 20 deletions
@@ -17,7 +17,6 @@ update_net () { net="$(if nmcli -t --fields type,state device | grep -q '^\(ethernet\|wifi\):connected$'; then echo 1; else echo 0; fi)" case "$(nmcli -t --fields device,state device)" in *wg_ia:connected*) wg=I;; - *wg_ka:connected*) wg=K;; *wg_mydefault:connected*) wg=D;; *wg_studio:connected*) wg=S;; *) wg=0;; @@ -3,7 +3,7 @@ ssh-add -l || ssh-add -for host in ca ka ia studio pp; do +for host in ca ia studio pp; do # alacritty use -T to change window name so I can identify different servers # need to invoke bash afterwards for manual things like reboot if linux upgrades and pacdiff # maybe can automate further so no need manual things @@ -4,7 +4,7 @@ all () { fast clean [ "$hostname" != xyzpp ] && refl - if [ "$hostname" = xyzka ] || [ "$hostname" = xyzia ]; then + if [ "$hostname" = xyzia ]; then qb fi [ "$hostname" = xyzinsp ] && music @@ -20,16 +20,16 @@ backup () { esac if [ "$hostname" = xyzinsp ]; then - # Pull repos and branches from studio, so one more backup on insp or duplicity will backup to ka,for one more backup for 321 backup rule + # Pull repos and branches from studio, so one more backup on insp or duplicity will backup to ia,for one more backup for 321 backup rule # cfgl master and pp branches already satisfy 321 rule. Here are three copies: 1. master/pp, 2. studio, 3. gitlab or alternative # But I still copy those on insp because one more copy will not hurt. And all my other data stil satisfy 3 copies without backup to gitlab, so why left out cfgl? Also it may be nice if I what to use that local dir for searching things. cd "$HOME/programs/config_local_arch" || exit 1 git branch | awk '{print ($1=="*")?$2:$1}' | while read -r branch; do git checkout "$branch" git pull - # Push ka and ia branch to codeberg or any future alternative website for mirroring. Needed for public codes/data, considering my death may result in all copies on my computers being lost. + # Push ca and ia branch to codeberg or any future alternative website for mirroring. Needed for public codes/data, considering my death may result in all copies on my computers being lost. case "$branch" in - ka|ia|ca) git push;; + ia|ca) git push;; esac done # git checkout will change mtime, need to change back so rsync won't think it needs to backup these files @@ -41,8 +41,6 @@ backup () { ( umask 077 - # backup ka cfgs - sudo -E git -C /root/programs/config_local_arch_secrets_ka pull # backup studio cfgs, note: it backup a branch by clone/checkout to that branch first sudo -E git -C /root/programs/config_local_arch_secrets pull # backup ia cfgs @@ -57,20 +55,18 @@ backup () { fi if [ "$hostname" = xyzinsp ] || [ "$hostname" = xyzstudio ]; then - # rsync backup from ka - rsync -avPR --delete ka:/home/xyz/.config/qBittorrent :/home/xyz/.local/share/qBittorrent/BT_backup "$HOME/backup/ka" # rsync backup from ia rsync -avPR --delete ia:/home/xyz/.config/qBittorrent :/home/xyz/.local/share/qBittorrent/BT_backup "$HOME/backup/ia" fi - if [ "$hostname" != xyzstudio ] && [ "$hostname" != xyzka ] && [ "$hostname" != xyzia ] && [ "$hostname" != xyzca ]; then + if [ "$hostname" != xyzstudio ] && [ "$hostname" != xyzia ] && [ "$hostname" != xyzca ]; then # rsync backup to studio # --files-from make -a not imply -r, so need to specify explicitly rsync -avPRr --delete --files-from="$XDG_CONFIG_HOME/myconf/upd_rsync_files" / "studio:/home/xyz/backup/$backup_branch" fi - if [ "$hostname" != xyzka ] && [ "$hostname" != xyzia ] && [ "$hostname" != xyzca ]; then - # duplicity backup to ka + if [ "$hostname" != xyzia ] && [ "$hostname" != xyzca ]; then + # duplicity backup to ia # https://wiki.archlinux.org/title/Duplicity # Need // for absolute path, see manpage URL FORMAT section. If not use //, will store to /home/xyz/home/xyz/... # --files-from has a bug, this bug makes source url that is / not working while /home works, more see vq notes @@ -78,7 +74,6 @@ backup () { use_agent= [ "$hostname" = xyzinsp ] && use_agent='--use-agent' sudo duplicity --ssh-askpass $use_agent --encrypt-key 9790577D2BE328D46838117ED3F54FE03F3C68D6 --sign-key 05899270DF25BB1EEDF57BE824F769E5D08C9E9A --full-if-older-than 2Y --include /etc/.cfgs --include-filelist "/home/xyz/.config/myconf/upd_rsync_files" --exclude / / "sftp://xyz@ia.flylightning.xyz//home/xyz/backup/$backup_branch" - sudo duplicity --ssh-askpass $use_agent --encrypt-key 9790577D2BE328D46838117ED3F54FE03F3C68D6 --sign-key 05899270DF25BB1EEDF57BE824F769E5D08C9E9A --full-if-older-than 2Y --include /etc/.cfgs --include-filelist "/home/xyz/.config/myconf/upd_rsync_files" --exclude / / "sftp://xyz@xyzka.kyun.li//home/xyz/backup/$backup_branch" fi } @@ -116,7 +111,7 @@ clean () { fast () { pac misc - if [ "$hostname" != xyzka ] && [ "$hostname" != xyzia ] && [ "$hostname" != xyzca ]; then + if [ "$hostname" != xyzia ] && [ "$hostname" != xyzca ]; then backup fi } @@ -218,7 +213,7 @@ refl () { # rsync may need to change XferCommand in /etc/pacman.conf # https://www.reddit.com/r/archlinux/comments/mynw6e/rsync_mirrors_with_pacman/ # need --delay so no super out of sync mirrors - if [ "$hostname" != xyzka ] && [ "$hostname" != xyzia ]; then + if [ "$hostname" != xyzia ]; then sudo reflector --verbose --save /etc/pacman.d/mirrorlist --country us --protocol https --delay 1 --latest 25 --score 25 --fastest 10 else sudo reflector --verbose --save /etc/pacman.d/mirrorlist --country ro --protocol https --delay 1 --fastest 3 @@ -3,7 +3,6 @@ case "$(nmcli -t --fields device,state device)" in *wg_ia:connected*) echo ia;; - *wg_ka:connected*) echo ka;; *wg_mydefault:connected*) echo mydefault;; *wg_studio:connected*) echo studio;; *) echo none;; @@ -14,8 +13,8 @@ printf '6: '; curl -6m1 ifconfig.co # the old way, slower and more code #nm_device_state="$(nmcli -t --fields device,state device)" -#if echo "$nm_device_state" | grep -q '^wg_ka:connected$'; then -# echo ka +#if echo "$nm_device_state" | grep -q '^wg_ia:connected$'; then +# echo ia #elif echo "$nm_device_state" | grep -q '^wg_studio:connected$'; then # echo studio #else @@ -2,7 +2,7 @@ # toggle VPN down_not_mydefault () { - for v in wg_studio wg_ia wg_ka; do + for v in wg_studio wg_ia; do nmcli connection down "$v" done } |