简体   繁体   English

如何使用挂载的文件系统在远程服务器上使用本地库运行子进程?

[英]How do I run a subprocess using local librairies on a remote server using mounted file systems?

I am using a subprocess to run a program on another machine through a mounted network file system. 我正在使用子进程通过已安装的网络文件系统在另一台机器上运行程序。

For my first step in this project I have been using sshfs mount and wget: 对于我在这个项目中的第一步,我一直在使用sshfs mount和wget:

sys_process = subprocess.Popen(wget_exec.split(), stdout=subprocess.PIPE, stderr=subprocess.PIPE)
  • using the command: wget works perfectly 使用命令: wget完美运行
  • using the command: /mnt/ssh_mount/wget does not execute 使用命令: /mnt/ssh_mount/wget不执行

System libraries: 系统库:

  • my remote system is: Arch Linux which is calling for libpcre.so.1 我的远程系统是:Arch Linux,它正在调用libpcre.so.1
  • my local system is: Ubuntu which uses libpcre3 so libpcre.so.1 is missing 我的本地系统是:Ubuntu,它使用libpcre3,因此缺少libpcre.so.1

I know this because when I call the wget command through the ssh mount (/mnt/ssh_mount/bin/wget) it throws an error. 我知道这一点,因为当我通过ssh mount(/ mnt / ssh_mount / bin / wget)调用wget命令时,它会抛出一个错误。 I do not wish to install needed libraries to all systems using this as it defeats the purpose of trying to run something remotely. 我不希望使用这个安装所有系统所需的库,因为它无法尝试远程运行某些东西。

For measure checks for permissions have been made 对于权限的度量检查已经进行

How do I get the command to use the local libraries? 如何获取使用本地库的命令?

I hope to use nfs as well which would exclude below as solutions: 我希望也使用nfs,它将在下面排除作为解决方案:

I have tried (with no success) os.chdir('/mnt/ssh_mount') 我试过(没有成功) os.chdir('/mnt/ssh_mount')

Error while loading shared libraries: 'libpcre.so.0: cannot open shared object file: No such file or directory' assumes a stable mount point which would cause changes in 2 places when the environment would change (this seems wrong from a database normalization background, I would assume code/sys admin as well) 加载共享库时出错:'libpcre.so.0:无法打开共享对象文件:没有这样的文件或目录'假设一个稳定的安装点,当环境发生变化时会导致2个位置发生变化(这似乎是数据库规范化的错误)后台,我会假设代码/系统管理员也是)

You are not actually running the wget command on the remote machine - you are trying to run the remote machine's binary on your local system, and the command is failing due to incompatible library versions. 您实际上并未在远程计算机运行wget命令 - 您尝试在本地系统上运行远程计算机的二进制文件,并且由于库版本不兼容而导致命令失败。 sshfs , nfs , and other types of network mounting protocols simply mount the remote filesystem as an extension of your local one - they don't allow for remote execution. sshfsnfs和其他类型的网络安装协议只是将远程文件系统挂载为本地扩展 - 它们不允许远程执行。 To do that, you'll need to open a remote shell using ssh tunneling and execute the Arch wget command through that. 为此,您需要使用ssh隧道打开远程shell并通过它执行Arch wget命令。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何在远程主机上运行本地python脚本并使用子进程与之通信? - How can I run a local python script on a remote host and communicate with it using subprocess? 如何使用python检查远程服务器上是否存在文件? - How do i check if a file exists on remote server using python? 在Python中使用子进程如何以管理员身份运行'openvpn'? - Using subprocess in Python how do I run 'openvpn' as administrator? 移动到远程服务器时如何引用本地文件? - How do I reference a local file when moving to a remote server? 使用 Google Cloud Run 时如何访问已安装的机密? - How do I access mounted secrets when using Google Cloud Run? 如何设置Jenkins CI服务器以使用远程webdriver运行自动BDD硒测试? - How do I set up a Jenkins CI server to run automated BDD selenium tests using a remote webdriver? 如何使用我的本地python安装在远程服务器上运行本地脚本? - How to run a local script on a remote server using my local python installation? 如何在 pytest 框架中运行使用 subprocess.run 的功能文件? - How to run feature file of using subprocess.run in pytest framework? 使用python子进程和ssh读取远程文件? - Read remote file using python subprocess and ssh? 如果远程文件比本地副本更新,如何使用boto从S3下载文件? - How do I download a file from S3 using boto only if the remote file is newer than a local copy?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM