Update server.py
Browse files
server.py
CHANGED
|
@@ -65,6 +65,7 @@ kill_frpc_processes()
|
|
| 65 |
|
| 66 |
# Oneapi中转
|
| 67 |
def Oneapi():
|
|
|
|
| 68 |
# 删除旧的 one-api 文件夹(如果存在)
|
| 69 |
os.system("rm -rf /one/one-api") # 使用 -f 参数以避免错误
|
| 70 |
os.system("mkdir -p /one") # 创建目录
|
|
@@ -87,10 +88,12 @@ def Oneapi():
|
|
| 87 |
command = ['/one/one-api', '--port', '3000']
|
| 88 |
process = subprocess.Popen(command) # 启动程序并将其放到后台执行
|
| 89 |
print(f"OneAPI程序已在后台启动,进程ID为:{process.pid}")
|
|
|
|
| 90 |
# Oneapi()
|
| 91 |
|
| 92 |
# SSH
|
| 93 |
def ssh():
|
|
|
|
| 94 |
subprocess.run("apt update", check=True, shell=True)
|
| 95 |
subprocess.run("apt install openssh-server -y", check=True, shell=True)
|
| 96 |
subprocess.run("apt-get install vim -y", check=True, shell=True)
|
|
@@ -100,17 +103,18 @@ def ssh():
|
|
| 100 |
run_command(config_server_cmd)
|
| 101 |
run_command("systemctl restart ssh")
|
| 102 |
os.system("/etc/init.d/ssh restart")
|
| 103 |
-
|
| 104 |
os.system("echo 'root:qilan' | sudo chpasswd")
|
| 105 |
os.system("echo 'PermitRootLogin yes' | sudo tee -a /etc/ssh/sshd_config")
|
| 106 |
os.system("service ssh restart ")
|
| 107 |
os.system("export LD_LIBRARY_PATH=$(echo $LD_LIBRARY_PATH | tr ':' '\n' | grep -v '/opt/conda/lib' | paste -sd ':') ")
|
|
|
|
| 108 |
# ssh()
|
| 109 |
clear_output()
|
| 110 |
|
| 111 |
|
| 112 |
|
| 113 |
def frp():
|
|
|
|
| 114 |
'''FRP配置'''
|
| 115 |
os.system("mkdir -p /content/frp")
|
| 116 |
os.system("wget /content/frp/frpc https://huggingface.co/Qilan2/box/resolve/main/frp/frpc -O /content/frp/frpc")
|
|
@@ -121,10 +125,11 @@ def frp():
|
|
| 121 |
# frpc 启动命令和参数
|
| 122 |
frpc_cmd = ['/content/frp/frpc', '-c', config_file_path]
|
| 123 |
subprocess.Popen(frpc_cmd)
|
|
|
|
| 124 |
# /content/frp/frpc -c /content/frp/frpc.ini
|
| 125 |
|
| 126 |
def SillyTavern():
|
| 127 |
-
|
| 128 |
# 创建目录并写入 kaggle.json
|
| 129 |
os.system("mkdir -p ~/.kaggle")
|
| 130 |
file_path = '/root/.kaggle/kaggle.json'
|
|
@@ -158,8 +163,10 @@ def SillyTavern():
|
|
| 158 |
|
| 159 |
os.system("cd /sillytavern")
|
| 160 |
os.system("ls")
|
|
|
|
| 161 |
subprocess.Popen(['yes | sh start.sh'])
|
| 162 |
subprocess.Popen(['yes | sh start.sh'])
|
|
|
|
| 163 |
# os.system("yes | sh start.sh -y")
|
| 164 |
|
| 165 |
# commands = [
|
|
|
|
| 65 |
|
| 66 |
# Oneapi中转
|
| 67 |
def Oneapi():
|
| 68 |
+
print('-----------Oneapi中转开始-------------')
|
| 69 |
# 删除旧的 one-api 文件夹(如果存在)
|
| 70 |
os.system("rm -rf /one/one-api") # 使用 -f 参数以避免错误
|
| 71 |
os.system("mkdir -p /one") # 创建目录
|
|
|
|
| 88 |
command = ['/one/one-api', '--port', '3000']
|
| 89 |
process = subprocess.Popen(command) # 启动程序并将其放到后台执行
|
| 90 |
print(f"OneAPI程序已在后台启动,进程ID为:{process.pid}")
|
| 91 |
+
print('-----------Oneapi中转结束-------------')
|
| 92 |
# Oneapi()
|
| 93 |
|
| 94 |
# SSH
|
| 95 |
def ssh():
|
| 96 |
+
print('-----------SSH开始-------------')
|
| 97 |
subprocess.run("apt update", check=True, shell=True)
|
| 98 |
subprocess.run("apt install openssh-server -y", check=True, shell=True)
|
| 99 |
subprocess.run("apt-get install vim -y", check=True, shell=True)
|
|
|
|
| 103 |
run_command(config_server_cmd)
|
| 104 |
run_command("systemctl restart ssh")
|
| 105 |
os.system("/etc/init.d/ssh restart")
|
|
|
|
| 106 |
os.system("echo 'root:qilan' | sudo chpasswd")
|
| 107 |
os.system("echo 'PermitRootLogin yes' | sudo tee -a /etc/ssh/sshd_config")
|
| 108 |
os.system("service ssh restart ")
|
| 109 |
os.system("export LD_LIBRARY_PATH=$(echo $LD_LIBRARY_PATH | tr ':' '\n' | grep -v '/opt/conda/lib' | paste -sd ':') ")
|
| 110 |
+
print('-----------SSH结束-------------')
|
| 111 |
# ssh()
|
| 112 |
clear_output()
|
| 113 |
|
| 114 |
|
| 115 |
|
| 116 |
def frp():
|
| 117 |
+
print('-----------FRP开始-------------')
|
| 118 |
'''FRP配置'''
|
| 119 |
os.system("mkdir -p /content/frp")
|
| 120 |
os.system("wget /content/frp/frpc https://huggingface.co/Qilan2/box/resolve/main/frp/frpc -O /content/frp/frpc")
|
|
|
|
| 125 |
# frpc 启动命令和参数
|
| 126 |
frpc_cmd = ['/content/frp/frpc', '-c', config_file_path]
|
| 127 |
subprocess.Popen(frpc_cmd)
|
| 128 |
+
print('-----------FPR结束-------------')
|
| 129 |
# /content/frp/frpc -c /content/frp/frpc.ini
|
| 130 |
|
| 131 |
def SillyTavern():
|
| 132 |
+
print('-----------SillyTavern开始-------------')
|
| 133 |
# 创建目录并写入 kaggle.json
|
| 134 |
os.system("mkdir -p ~/.kaggle")
|
| 135 |
file_path = '/root/.kaggle/kaggle.json'
|
|
|
|
| 163 |
|
| 164 |
os.system("cd /sillytavern")
|
| 165 |
os.system("ls")
|
| 166 |
+
|
| 167 |
subprocess.Popen(['yes | sh start.sh'])
|
| 168 |
subprocess.Popen(['yes | sh start.sh'])
|
| 169 |
+
print('-----------SillyTavern结束-------------')
|
| 170 |
# os.system("yes | sh start.sh -y")
|
| 171 |
|
| 172 |
# commands = [
|