From 09763448f6caf824dbb00d77840e3f4c16468e78 Mon Sep 17 00:00:00 2001 From: smail Date: Fri, 11 Sep 2026 14:28:07 +0800 Subject: [PATCH] =?UTF-8?q?chore:=20=E6=9B=B4=E6=96=B0=E8=BF=9C=E7=A8=8B?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E5=BA=93=E6=A3=80=E6=9F=A5=E5=B7=A5=E5=85=B7?= =?UTF-8?q?=E8=84=9A=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- test/tools/check_remote_db.py | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/test/tools/check_remote_db.py b/test/tools/check_remote_db.py index 9fd7c044..ba5e905c 100644 --- a/test/tools/check_remote_db.py +++ b/test/tools/check_remote_db.py @@ -1,8 +1,17 @@ -import paramiko +import paramiko client = paramiko.SSHClient() client.set_missing_host_key_policy(paramiko.AutoAddPolicy()) client.connect('47.108.78.12', port=22, username='root', password='10102442Lb!', timeout=8) -cmd = 'systemctl list-unit-files | grep -E (mysql|mariadb|postgresql)' +cmd = 'systemctl list-unit-files | grep -E "(mysql|mariadb|postgresql)"' stdin, stdout, stderr = client.exec_command(cmd) -print(DB units:, stdout.read().decode('utf-8')) +print("DB units:\n", stdout.read().decode('utf-8')) + +cmd2 = 'sqlite3 /opt/smail/data/smail.db "SELECT id, account, name, role, is_admin FROM user;"' +stdin, stdout, stderr = client.exec_command(cmd2) +print("User table:\n", stdout.read().decode('utf-8')) + +cmd3 = 'sqlite3 /opt/smail/data/smail.db "SELECT count(*) FROM external_email;"' +stdin, stdout, stderr = client.exec_command(cmd3) +print("External email count:\n", stdout.read().decode('utf-8')) + client.close()