Reputation: 55
Hope you are doing great.
I am reaching out to the community as I am currently stuck with a problem of executing a sequence of commands from a linux machine using jmeter.
A bit of Background:-
I have an external VM which is used to mimic the transfer of file to various inbound channels. This VM is basically acting as a third party which hosts files which are then transferred to different location by following a sequence of commands
The Sequence of Commands that I am trying to execute to mimic the third party are as below
ls (to list the files in the Home Dir)
mv test123.txt test456.txt (This renames the file in the home Dir from test123.txt to test456.txt)
Then we connect to the File exchange server using the command below
Once Connected we execute the below sequence
Post the execution of the last command the file is transferred to internal folder based on account ID
I did some search on stack over flow and found a couple of links but was not able to make successful use of it to simulate the above sequence of commands
The closest one I could find is as below
How to execute Linux command or shell script from APACHE JMETER
But this does not talk about executing from a linux machine itself
Any help on how to approach this one will help me out. Thanks in advance
PS:- I am using jmeter cause I have to keep this sequence executing continuously till I transfer the expected number of file in a peak hour durations and these files are of different sizes ranging from few MB's to a couple of GB's
New Edit
I used the JSR223 Pre-Processor where I have my sequence of commands and then I call that command in the OSS Sampler and created a script as below
The script executes on the Linux box without any error but the file is not transferred to the destination. Am I missing something?
On some research I did found an lftp command but not sure how to use in my case and if that will work or not.
Any suggestions?
Upvotes: 0
Views: 185
Reputation: 168082
To execute commands on local Linux machine you can use OS Process Sampler
To execute commands on remote Linux machine you can use SSH Command Sampler
See How to Run External Commands and Programs Locally and Remotely from JMeter article for more information if needed.
To transfer the file from local to remote you can use SSH SFTP Sampler
In order to get SSH Command and SSH SFTP Samplers install SSH Protocol Support plugin using JMeter Plugins Manager:
Upvotes: 1