Hw to execute command in background

439 views
Skip to first unread message

NAGENDRA KUMAR

unread,
Oct 19, 2021, 10:46:45 AM10/19/21
to robotframework-users
Hi Team,

I need to execute command(tcpreplay -i dummy0 -M 50 file name)  in linux server which usually takes around 20 minutes to complete, in mean time need to open another session and run some command to check  whether certain values are increasing or not after executing the command.

If i use "write" Keyword it will execute command but session will not run In background it will close session immediately so that session will expire and process got killed.

if i use "execute command"  need to wait until it completes (cannot capture intermediate results)

I need to run this command in backend so that i can capture intermediate results by executing other commands

even i try '&' and 'nohup' command but didn't find any solution.

Pls help me on this

Craig Despeaux

unread,
Oct 19, 2021, 12:25:28 PM10/19/21
to robotframework-users
Have you tried using Start Process from the Process library?  If you're running tcprelay via ssh, I have successfully used Start Process with ssh -f to run a process in the background on a remote host.  I've also successfully used ssh with & at the end of the command with shell=yes.

I should think Start Process with & should work running a command locally, as well, but none of my testing has called for that.

Craig

NAGENDRA KUMAR

unread,
Oct 28, 2021, 4:02:10 AM10/28/21
to robotframework-users
Hi Craig,

Thanks for information.

Actually i tired get the information regrading that start process but not able find solution for the above problem .can you please help on this

My requirement i need to execute the tcpreplay command in some folder where traffic file is reside

command : tcpreplay -i dummy0 -M 50 Telcel_R3_CENTAUR_MME01_S6a.pcap
directory:cd /var/opt/traffic


As whole my command will be cd /var/opt/traffic;tcpreplay -i dummy0 -M 50 Telcel_R3_CENTAUR_MME01_S6a.pcap

i will be login to system using open connection with ssh library and trying to execute that command

Open Connection    ${ProbeServerIP}    port=22
    Login    ${ProbeUsername}    ${Probepassword}
    Start Process    cd /var/opt/traffic; tcpreplay -i dummy0 -M 50 Telcel_R3_CENTAUR_MME01_S6a.pcap &   alias=First

even i tired with command
    Start Process    tcpreplay -i dummy0 -M 50 Telcel_R3_CENTAUR_MME01_S6a.pcap  cwd=cd /var/opt/traffic

got error:
FAIL : FileNotFoundError: [WinError 2] The system cannot find the file specified

Do we need create any file and place this command run this or hw can run this command 

Please help me on this
Reply all
Reply to author
Forward
0 new messages