如何在远程服务器上运行matlab程序

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了如何在远程服务器上运行matlab程序相关的知识,希望对你有一定的参考价值。

方法如下:
1、只需要在linux的命令行下执行:matlab
2、-nodesktop
-nosplash
-r
“你的程序的名字”
(前提是matlab所在的目录在你的PATH变量包含的目录中)
参考技术A 不是很明白你的意思,如果要实现多人同时连接到远程服务器,只须安装远程控制工具便行;本地要运行任何程序都不会影响远程控制工具;

如何通过 laravel 应用程序使用数字海洋服务器从另一台服务器在远程服务器上运行脚本文件

【中文标题】如何通过 laravel 应用程序使用数字海洋服务器从另一台服务器在远程服务器上运行脚本文件【英文标题】:How to run script file on remote server from another server using digital ocean servers through laravel app 【发布时间】:2020-08-20 21:20:31 【问题描述】:

当某些操作发生时,我的服务器上有一个 laravel 应用程序,它运行一个位于路径 /home/user/myFile.sh 上的 shell 脚本文件,我使用的是 Symfony component process,它是一个带有错误 Host key verification failed 的响应,当我使用来自服务器的终端它工作得很好。 我的问题是如何传递此错误以通过我的应用程序执行我的文件。

这个myFile.sh

#!/bin/bash
ssh myuser@xx.xx.xx.xx "bash -s" <<'ENDSSH'
/home/user/another_file.sh $1 $2 $3

laravel 应用内的代码:


public function do()

  $process = new Process(['/home/user/myFile.sh'], null, ['param1', 'param2', 'param3']);
  $process->run();

  if (!$process->isSuccessful()) 
    throw new ProcessFailedException($process);
  

   return $process->getOutput();


another_file.sh 在远程服务器上:

#!/bin/bash

p1= $1;
p2= $2;
p3= $3;

echo "script executed successfully";

【问题讨论】:

【参考方案1】:

这在 AskUbuntu 上得到了很好的回答; https://askubuntu.com/a/323629/641754:

如果您在某些远程/脚本编写情况下运行,而您缺乏对 prompt-to-add-hostkey 的交互式访问,请按以下方式解决它:

$ ssh -o StrictHostKeyChecking=no myuser@xx.xx.xx.xx "bash -s" <<'ENDSSH'

【讨论】:

谢谢@James,我跟着你写我得到Failed to add the host to the list of known hosts Permission denied (publickey) 还是一样的结果! 当我使用 ssh -v... 时,我注意到它试图从我的应用程序所在的位置访问 ssh 密钥的错误 Failed to add the host to the list of known hosts (/var/www/.ssh/known_hosts)ssh -v... 当我运行new Process(['whoami'])它是打印www-data并发现www-data没有执行文件的权限时,我搜索查找执行文件的人 让我们continue this discussion in chat.

以上是关于如何在远程服务器上运行matlab程序的主要内容,如果未能解决你的问题,请参考以下文章

如何通过SSH在远程Linux服务器上启动GUI软件?

如何在 Eclipse IDE(同一台机器)中远程调试在 Web 逻辑服务器上运行的企业应用程序

如何通过 laravel 应用程序使用数字海洋服务器从另一台服务器在远程服务器上运行脚本文件

使用脚本保持远程会话运行直到程序结束?

NodeJS - 如何连接到运行 Node 应用程序的远程 PC?

如何远程运行 xcode 机器人