从 power shell 通过 ssh 远程运行命令

问题描述

当我从机器本身运行这个 ./start.sh 脚本时,exe 运行完美。但是当我尝试使用不同 Windows 机器的 PowerShell 远程运行此命令时,我收到此错误

**加载共享库时出错:libentity.so.5.4.beta:无法打开共享对象文件:没有这样的文件或目录

我曾尝试寻找相同的问题,但未能找到。

PS C:\Users\Administrator> plink -pw tpstps [email protected] "./start.sh"

Running comms.exe

Running abc.exe

Running PM2
TERM environment variable not set.
./comms.exe: error while loading shared libraries: libentity.so.5.4.beta: cannot open shared object file: No such file or directory
./abc.exe: error while loading shared libraries: libboost_serialization.so.1.59.0: cannot open shared object file: No such file or directory

start.sh 文件

echo
echo "Running comms.exe"
./comms.exe&

echo
echo "Running abc.exe"
./abc.exe&

echo
echo "Running PM2"
pm2 start

exit 0

解决方法

问题已解决,我必须在执行 .sh 文件之前将源设置为我的 bash_profile。现在,工作命令如下所示:

plink -pw tpstps [email protected] "source ~/.bash_profile; ./start.sh"