linux - 如何在 Linux 中从 OS Process Sampler 执行 jar

标签 linux process operating-system jmeter

如何在 Linux 中从 OS Process Sampler 执行 jar?我有以下attached采样器在 Windows 中运行良好。如何在 Linux 中执行此 OS Process Sampler?

最佳答案

Linux 等效项类似于:

  • 命令:/bin/bash(或其他可能不同的 Unix Shell)
  • 工作目录:就像在 Windows 上一样,指定命令的工作文件夹
  • 命令参数:

    • -c - 根据bash user manual

      -c string

      If the -c option is present, then commands are read from string. If there are arguments after the string, they are assigned to the positional parameters, starting with $0.

    • 您的实际命令。如果命令包含空格或任何其他需要转义的特殊字符 - 使用 \ 符号转义它们或用 引号将命令引起来

      ""java -jar myjar.jar param1 param2""
      

请记住,在 Linux 中文件名区分大小写,因此将 Java 更改为 java,因为从 Linux 的角度来看,这两个是完全不同的野兽。

示例配置:

JMeter help execution os process sampler

示例输出:

Os process sampler output

查看How to Run External Commands and Programs Locally and Remotely from JMeter有关此方法和其他方法的全面解释。

关于linux - 如何在 Linux 中从 OS Process Sampler 执行 jar,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38181399/

相关文章:

python - 如何在 linux 终端中使用 '$' 输入 sftp 密码

linux - 从一个来源为数据文件创建多个 Debian 软件包

linux - fork() 如何知道它是在子进程中还是在父进程中?

python-3.x - 权限错误: [WinError 5] Access is denied for creating file

linux - linux/unix 中的 spawn、expect 和 send 命令是什么

c - 从Linux内核解释notifier.c

linux - 如何确定Linux中的进程内存限制?

windows - 在 Windows 中休眠单个进程

c - 电脑关机,操作系统如何实现呢? (C内核开发)

linux - 如果一端先于另一端关闭,Linux pipe() 会发生什么