Running a JMeter script with nohup

2019-08-14 17:49发布

问题:

For the first time I'm just playing around with nohup on top of an Ubuntu server. I read few docs about nohup and got to know about the running commands with options such as nohup ./server.sh &.

What I want to know is that, how should I be running the JMeter script (in headless mode) using nohup? Following is the script I needed to run with nohup:

./jmeter.sh -n -t /home/chamith/WSO2MB/new/apache-jmeter-2.13/bin/GamesSubscriber.jmx

When I tried using the normal nohup operation within the script it always throws me an error saying -n command not found. How should I move on with this? Any help would be appreciated.

回答1:

Although I cannot reproduce your issue you can try surrounding your command with quotation marks like:

nohup "./jmeter.sh -n -t /home/chamith/WSO2MB/new/apache-jmeter-2.13/bin/GamesSubscriber.jmx"

Also don't forget -l key to save the results into a file.

The full command which runs script totally in the background will look like:

nohup "./jmeter.sh -n -t /home/chamith/WSO2MB/new/apache-jmeter-2.13/bin/GamesSubscriber.jmx -l result.jtl" > /dev/null 2>&1 &

References:

  • nohup man page
  • nohup Execute Commands After You Exit From a Shell Prompt
  • How Do I Run JMeter in Non-GUI Mode?
  • Full list of JMeter command-line options