Qilan2 commited on
Commit
1f47343
·
verified ·
1 Parent(s): 3190745

Update Card_Hub.py

Browse files
Files changed (1) hide show
  1. Card_Hub.py +0 -37
Card_Hub.py CHANGED
@@ -533,43 +533,6 @@ def sync_database():
533
  # 修复权限
534
  subprocess.run(f"chmod 666 {db_path}", shell=True)
535
  subprocess.run(f"chown root:root {db_path}", shell=True)
536
- finally:
537
- # 5. 检查是否需要重启服务
538
- try:
539
- # 检查当前服务是否在运行
540
- with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as sock:
541
- result = sock.connect_ex(('localhost', 8003))
542
- if result != 0: # 如果服务没有运行
543
- print("服务未运行,准备启动...")
544
- os.chdir('/Card_Hub/RoleCardSite')
545
- # 修复权限问题
546
- subprocess.run('chmod +x ./start.sh', shell=True)
547
-
548
- # 修复客户端权限
549
- client_path = './client'
550
- subprocess.run(f'chmod -R 755 {client_path}/node_modules', shell=True)
551
- subprocess.run(f'chmod +x {client_path}/node_modules/.bin/*', shell=True)
552
-
553
- # 特别修复 esbuild 权限
554
- esbuild_path = f'{client_path}/node_modules/@esbuild/linux-x64/bin/esbuild'
555
- if os.path.exists(esbuild_path):
556
- subprocess.run(f'chmod +x {esbuild_path}', shell=True)
557
- subprocess.run(f'chown root:root {esbuild_path}', shell=True)
558
-
559
- # 修复服务器权限
560
- server_path = './server'
561
- subprocess.run(f'chmod -R 755 {server_path}/node_modules', shell=True)
562
- subprocess.run(f'chmod +x {server_path}/node_modules/.bin/*', shell=True)
563
-
564
- # 修复项目文件权限
565
- subprocess.run('chmod -R 755 .', shell=True)
566
-
567
- # 启动服务
568
- subprocess.run('sh ./start.sh', shell=True)
569
- else:
570
- print("服务正在运行,跳过启动步骤")
571
- except Exception as e:
572
- print(f"检查服务状态时出错: {e}")
573
 
574
  def frp(configs, backstage):
575
  print('-----------FRP开始-------------')
 
533
  # 修复权限
534
  subprocess.run(f"chmod 666 {db_path}", shell=True)
535
  subprocess.run(f"chown root:root {db_path}", shell=True)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
536
 
537
  def frp(configs, backstage):
538
  print('-----------FRP开始-------------')