From 6d419dde4989cf5176ca1f6df063cc6c17ba8b13 Mon Sep 17 00:00:00 2001
From: Recolic <git@me.recolic.net>
Date: Fri, 21 Feb 2025 18:23:44 -0800
Subject: [PATCH] .

---
 archived/mspc-quick-conn.sh                | 37 ++++++++++++++++++++++
 fish-config/functions/nupkg-repak.fish     |  2 +-
 storage-server-backup-sh/README.md         |  4 +--
 storage-server-backup-sh/check_extern.fish |  8 +++--
 storage-server-backup-sh/daily.fish        |  8 ++---
 5 files changed, 49 insertions(+), 10 deletions(-)
 create mode 100644 archived/mspc-quick-conn.sh

diff --git a/archived/mspc-quick-conn.sh b/archived/mspc-quick-conn.sh
new file mode 100644
index 0000000..7147f95
--- /dev/null
+++ b/archived/mspc-quick-conn.sh
@@ -0,0 +1,37 @@
+#!/bin/fish
+set ip $argv[1]
+
+set pool "
+4 52.225.221.93
+5 52.225.219.189
+6 68.154.25.86
+7 68.154.24.234
+lb2 40.79.34.210
+lb1 172.176.121.136
+
+261 20.252.245.95
+262 20.168.171.4
+263 20.252.220.183
+26l 20.252.233.54
+#26l2 20.1.113.101
+26l2 proxy-cdn.recolic.net:30651
+"
+
+if not string match "*.*" $ip
+    if string match "*l*" $ip
+        set port 8888 # lb default port
+    else
+        set port 22
+    end
+    set ip (echo $pool | grep "^$ip " | cut -d ' ' -f 2)
+    if string match "*:*" $ip
+        # ip contains port.. split it
+        set port (echo $ip | cut -d : -f 2)
+        set ip (echo $ip | cut -d : -f 1)
+    end
+    echo ADDR=$ip:$port
+end
+
+echo "ERROR: PASSWORD CENSORED"
+sshpass -p ___ ssh -o ServerAliveInterval=3 -p $port r@$ip
+
diff --git a/fish-config/functions/nupkg-repak.fish b/fish-config/functions/nupkg-repak.fish
index 0313f74..e8934b3 100644
--- a/fish-config/functions/nupkg-repak.fish
+++ b/fish-config/functions/nupkg-repak.fish
@@ -3,7 +3,7 @@ set nu $argv[1]
 mkdir -p $nu.wd ; cd $nu.wd
 unzip ../$nu ; or unzip $nu ; or return 1
 cd content/Redist
-rm remote/*.lib ; rm remote/*.pdb ; cd ..
+rm remote/*.lib ; rm remote/*.pdb ; rm -f remote/no-grpc/vfpremoteapi.lib ; cd ..
 zip -r r.zip Redist ; or return 2
 echo "DONE. CHECK r.zip"
 end
diff --git a/storage-server-backup-sh/README.md b/storage-server-backup-sh/README.md
index 80c7d16..5fa8431 100644
--- a/storage-server-backup-sh/README.md
+++ b/storage-server-backup-sh/README.md
@@ -39,11 +39,11 @@ fish 3.x (to eval variable without `eval`)
 ## migration guide
 
 ```
-Copy the following things to new machine:
+# Copy the following things to new machine:
 /root/.ssh
 /storage
 crontab -l
-[optional] /etc/ssh (and restart sshd afterward)
+# [optional] /etc/ssh (and restart sshd afterward)
 
 # If fish version < 3.0, install latest fish 3.x:
 apt install software-properties-common
diff --git a/storage-server-backup-sh/check_extern.fish b/storage-server-backup-sh/check_extern.fish
index 60595d1..0eba824 100644
--- a/storage-server-backup-sh/check_extern.fish
+++ b/storage-server-backup-sh/check_extern.fish
@@ -1,12 +1,14 @@
 #!/bin/fish
 # check if necessary service for external users are running, and start them if not.
-# note: tested 4.2GB (4404019200) file upload, webdav server works.
+# note: tested 4.2GB (4404019200B) & 15GB file upload, webdav server works.
 
 if ps aux | grep [w]ebdav
     exit 0 # service already running
 end
 
 set EXTERN_WEBDAV_KEY _PLACEHOLDER_WEBDAV_KEY_
+# set EXTERN_DIR      /storage/backups/extern # Not in use yet
+set EXTERN_DIR        /storage/tmp
 
 if not test -f /usr/bin/webdav
     set HTTP_PREFIX "https://recolic.net/hms.php?/softwares/bin/linux-amd64"
@@ -17,7 +19,7 @@ end
 
 if not test -f /etc/webdav.yaml
     echo "
-directory: /storage/backups/extern
+directory: $EXTERN_DIR
 users:
   - username: extern
     password: $EXTERN_WEBDAV_KEY
@@ -26,6 +28,6 @@ users:
     or exit 1
 end
 
-mkdir -p /storage/backups/extern/
+mkdir -p $EXTERN_DIR
 nohup /usr/bin/webdav --config /etc/webdav.yaml > /var/log/extern-server.log 2>&1 & disown
 
diff --git a/storage-server-backup-sh/daily.fish b/storage-server-backup-sh/daily.fish
index e632ddf..5e212db 100755
--- a/storage-server-backup-sh/daily.fish
+++ b/storage-server-backup-sh/daily.fish
@@ -50,10 +50,10 @@ end
 ./old-backup-clean.exe /storage/backups
 
 # Send warning if running out of harddisk (less than 100GiB left)
-# test (df -T | grep /storage | tr -s ' ' | cut -d ' ' -f 3,5 | sed 's/^.* //g') -lt 104857600
-# Modify the filter to make it working on base.lt1.recolic.net. time4vps mount 2TB HDD at /
-test (df -T | grep /dev/ploop | tr -s ' ' | cut -d ' ' -f 3,5 | sed 's/^.* //g') -lt 104857600
-    and email_notify "Backup system has low disk space. "(df -Th | grep /dev/ploop)
+# Modify & test this when moving to new system.
+set space_check_df_keyword /dev/mapper/ubuntu--vg-lv--root
+test (df -T | grep $space_check_df_keyword | tr -s ' ' | cut -d ' ' -f 3,5 | sed 's/^.* //g') -lt 104857600
+    and email_notify "Backup system has low disk space. "(df -Th | grep $space_check_df_keyword)
 
 # Not used by any extern user right now... But still worth keep it running.
 fish check_extern.fish
-- 
GitLab