wmdjt commited on
Commit
b3377ed
·
verified ·
1 Parent(s): ccbadca

Create start_server.sh

Browse files
Files changed (1) hide show
  1. start_server.sh +38 -0
start_server.sh ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/bash
2
+
3
+ # 最大权限应用启动脚本
4
+ echo "=== 启动最大权限应用服务 ==="
5
+
6
+ # 启动SSH服务(允许远程root访问)
7
+ sudo service ssh start
8
+
9
+ # 启动Jupyter(允许root运行)
10
+ JUPYTER_TOKEN="${JUPYTER_TOKEN:=huggingface}"
11
+
12
+ NOTEBOOK_DIR="/data"
13
+
14
+ jupyter labextension disable "@jupyterlab/apputils-extension:announcements"
15
+
16
+ jupyter-lab \
17
+ --ip 0.0.0.0 \
18
+ --port 8006 \
19
+ --no-browser \
20
+ --allow-root \
21
+ --ServerApp.token="$JUPYTER_TOKEN" \
22
+ --ServerApp.tornado_settings="{'headers': {'Content-Security-Policy': 'frame-ancestors *'}}" \
23
+ --ServerApp.cookie_options="{'SameSite': 'None', 'Secure': True}" \
24
+ --ServerApp.disable_check_xsrf=True \
25
+ --LabApp.news_url=None \
26
+ --LabApp.check_for_updates_class="jupyterlab.NeverCheckForUpdate" \
27
+ --notebook-dir=$NOTEBOOK_DIR
28
+ # 启动GPU监控
29
+ sudo gpustat -i 5 &
30
+
31
+ # 启动多个Gradio服务(最大端口权限)
32
+ for port in 7860 8000 8001 8002; do
33
+ python -m gradio app.py --server-port $port --share &
34
+ done
35
+
36
+ # 保持容器运行(最大权限shell)
37
+ echo "=== 所有服务已启动,进入最大权限Shell ==="
38
+ exec sudo /bin/bash