Compare commits

..

No commits in common. "10c1f0c2683c9ca8e27ad0461ae76fc4d42f7741" and "e317df2fac8f4319f39a3bdc1b888dded8090020" have entirely different histories.

View File

@ -103,23 +103,23 @@ async def ssh_execute_command_noroot(host, port, username, password, commands, r
for temp_path, final_path in temp_scp_map.items():
# 确保目标目录存在
mkdir_cmd = f"sudo mkdir -p $(dirname {final_path})"
await execute_sudo_command(ssh, mkdir_cmd, password, real_time_log, sudo_timeout, username)
execute_sudo_command(ssh, mkdir_cmd, password, real_time_log, sudo_timeout, username)
# 移动文件
move_cmd = f"sudo mv {temp_path} {final_path}"
await execute_sudo_command(ssh, move_cmd, password, real_time_log, sudo_timeout, username)
execute_sudo_command(ssh, move_cmd, password, real_time_log, sudo_timeout, username)
# 设置文件权限
chmod_cmd = f"sudo chmod 644 {final_path}"
if final_path.endswith('.sh'): # 脚本文件设置可执行权限
chmod_cmd = f"sudo chmod 755 {final_path}"
await execute_sudo_command(ssh, chmod_cmd, password, real_time_log, sudo_timeout, username)
execute_sudo_command(ssh, chmod_cmd, password, real_time_log, sudo_timeout, username)
# 执行远程命令(如果需要)
if remote_exec:
for command in commands:
# 执行需要sudo权限的命令
result, error = await execute_sudo_command(ssh, command, password, real_time_log, sudo_timeout, username)
result, error = execute_sudo_command(ssh, command, password, real_time_log, sudo_timeout, username)
all_results.append((result, error))
# 清理临时目录