What is the difference between -p and -q options - jmeter

We have decided to split our jmeter properties into 2 files. One contains more "environment" related variables and the other contains more application centric (stuffs that changes with version).
Everything seems to work fine when using "jmeter.sh -q file1 -q file2 -t test.jmx". However we found there was also a -p option. In which context should it be use (vs the -q?)

According to the documentation:
-p, --propfile {argument}
the jmeter property file to use
-q, --addprop {argument}
additional property file(s)
this is, using -p you overwrite jmeter.properties, using -q adds a custom properties file.

Related

Unix side-by-side difference with a remote hidden file

I am working on a battery of automatic tests which executes on 2 Unix virtual machines running with KSH. Those VMs are independant and they have practically the same .profile file. I would like to study their differences by launching:
tkdiff /usr/system/.profile system#{external_IP}:/usr/system/.profile
on the first VM but it doesn't work.
I suppose that directly accessing a hidden file is not possible. Is there a solution to my problem, or maybe an alternative?
If you want to compare different files on two remote machines, I suggest the following procedure:
1. Compare checksums:
First compare the checksums. Use sum, md5sum or sha256sum to compute a hash of the file. If the hash is the same, the probability of having the same file is extremely high! You can even increase that probability by check the total amount of characters, lines and words, in the file using wc.
$ file="/usr/system/.profile"
$ md5sum "$file" && wc "$file"
$ ssh user#host "md5sum '$file' && wc '$file'"
2. run a simple diff
Run a simple diff using the classic command line tools. They understand the POSIX standard to use - as /dev/stdin. This way you can do:
$ ssh user#host "cat -- '$file'" | diff "$file" -
note: with old versions of tkdiff or new versions of svn/git, it can be tricky here due to bugs in tkdiff. It will quickly throw errors of the form svn [XXXX] file .... is not a working copy or file xxxx is not part of a revision control system if one of the files might be under version control or you end up in a directory under version control. Stick to diff!
You are using the filename convention "user#host:/path/to/file" for the second argument to tkdiff.
That convention for naming is not native to Ksh, but instead is understood by some programs like scp and others (which can be interactive, e.g. to ask for a password for the remote system or other authentication related questions).
But from the tkdiff man page, it does not mention having built-in support for that filenaming convention userid#host:/path/to/file, and neither is such support built into ksh.
So you may need to use two steps, first to use scp or similar to copy the remote file locally then then use tkdiff with one argument the local file and the other the file-just-copied, or arrange to mount part of the other VM filesystem locally, and then use tkdiff with appropriate arguments.
Obviously, both files need to be readable by your userid or the user specified on the userid#host:/path/to/file for this to work.
You can directly made a remote ssh compare , run a remote display with help of cat command line, with this :
tkdiff <(ssh system#{external_IP}1 'cat /usr/system/.profile') <(ssh system#{external_IP}2 'cat /usr/system/.profile')
In your case to be able to compare with the local .profile file this :
tkdiff /usr/system/.profile <(ssh system#{external_IP} 'cat /usr/system/.profile')
Do you have just try with the simple diff command line (with -b -B option to remove blank line and space comparaison):
diff -b -B /usr/system/.profile <(ssh system#{external_IP} 'cat /usr/system/.profile')

using getopts to have 1 option require 4 options

I have been trying to read a lot about getops for bash because I have a project that requires the use of it for a script. The issue is I cannot find what I want to call nested options (if its even called that) For the project I am required to have say 3 options that are optional. But if the user choses say option -i they are required to have options -f -l -e -n how would I be able to implement that?

Modify ext4 file system to add custom attribute for files

I'm not very experienced in Linux kernel so I don't have idea how to do this.
What I have to do is to modify ext4 file system to add custom attributes in files (e.g. to add original location when file was created). So, not to add custom attribute to a particular file, but to all files when they are being created, automatically.
Any idea, or some link for deeper investigation?
Thanks
You will need something like extended attributes 'attr':
$ man attr
...
OVERVIEW
Extended attributes implement the ability for a user to attach name:value pairs to objects within the XFS
filesystem.
...
Install the command if it is not present in your system:
$ sudo apt install attr
I've used it within an ext4 file system:
$ echo "testing attr command" > test.txt
$ setfattr -n user.new_attr -v "attribute value" test.txt
$ getfattr -n user.new_attr test.txt
# file: test.txt
user.new_attr="attribute value"
Now you just need to intercept the creation of a file. You can use incron, as explained in:
Executing a bash script upon file creation
For more information, you can take a look at their respective man pages.

How to generate .jtl file in jmeter with unique name?

I have a doubt.
I want to create .jtl file with uniqe name in yy-mm-dd-time format.
How can i do this?
If you want to use JMeter listener to write JTL file, you can use time function (and put it into filename parameter of listener) like:
${__time(yy-MM-dd-HH-mm-ss)}.jtl
It also has shortcuts that you may want to use.
If you want to create JTL via -l command line option, you can use usual command line possibilities. For example in linux you can do:
sh jmeter.sh -n -t "TestPlan.jmx" -l $(date -d "today" +"%Y-%m-%d-%H-%M-%S").jtl

Specify Doxygen parameters through command line

Well I am creating a script to automatically generate documentation for my projects with Doxygen, which seems like an awesome tool.
What is not clear to me, is if the user can use specify directly parameters, such as project name, project description etc., by setting them besides command:
doxygen -g "parameter modification here"
doxygen Doxyfile
Any tips appreciated!
Look at the answer for question 17 in the FAQ: http://www.doxygen.nl/manual/faq.html#faq_cmdline, repeated below for convenience:
Can I configure doxygen from the command line?
Not via command line options, but doxygen can read from stdin, so you can pipe things through it. Here's an example how to override an option in a configuration file from the command line (assuming a UNIX environment):
( cat Doxyfile ; echo "PROJECT_NUMBER=1.0" ) | doxygen -
For Windows the following would do the same:
( type Doxyfile & echo PROJECT_NUMBER=1.0 ) | doxygen.exe -
If multiple options with the same name are specified then doxygen will use the last one. To append to an existing option you can use the += operator.
(This is an alternative to the accepted answer - most likely above.)
My preferred solution is to use environmental variables in the config file. Let's take "QUIET" as an example: In the config file I replace
QUIET = NO
with
QUIET = $(DOXYGEN_QUIET)
I then call Doxygen as follows
DOXYGEN_QUIET=YES doxygen configfile
or
env DOXYGEN_QUIET=YES doxygen configfile
if used inside a (Bash) script. You could of course also export the variable DOXYGEN_QUIET so you don't have to type it for each run.
PS! I have a Bash script that run several Doxygen jobs, and it uses the standard -q option to run the jobs quietly by setting DOXYGEN_QUIET. I also set PROJECT_NAME using the same trick with an environmental variable.
As far as I know this is not possible: a doxygen build is configured through the configuration file or with the GUI (which is much easier than trying to remember command line option names). Typing doxygen --help at the command line and the documentation for the doxygen usage suggest that all the command line options do is set which configuration file to read (and allow the user to get layout files and the like).
One way to modify configuration options from the command line would be to append options to the configuration file using something like (untested):
echo "INPUT = some file" >> Doxyfile
This will append INPUT = some file to your Doxyfile and any earlier values of INPUT are ignored. If you want to append an item to INPUT you could use
echo "INPUT += some file" >> Doxyfile
Notice the +=. This respects INPUT values set earlier in the file.
Rather than appending to the configuration file you could always use sed to find and replace options.

Resources