So I want to run Apache benchmark but while it's running, I need to run htop to see the memory and CPU usage. How can I do that? Putty (My ssh client) won't let me type in a command until ab is done running.
Ideas?
So I want to run Apache benchmark but while it's running, I need to run htop to see the memory and CPU usage. How can I do that? Putty (My ssh client) won't let me type in a command until ab is done running.
Ideas?
You can do this in the same way that you would with a local shell, using job control. For example:
time ssh localhost 'bash -c "sleep 5 & sleep 6 &"'
... 0.00s user 0.01s system 0% cpu 6.187 total
Edit:
Oh, you just want to do it on from a terminal session. You just use job control by putting &
after the command, for example: benchmark &
and then htop
. This makes the job run in the background. You can then see which jobs are running with the jobs
command and bring it back to the foreground with fg %1
where 1 is the number of the job.
There are many solutions (run benchmark as background job), but the best solution is to use screen. It's "window manager" for console. You can create many windows, switch between them and even detach current session. It's a very powerful tool.
GNU Screen is a great application for running multiple processes (windows) inside of one SSH session. It must reside on the machine you connected to (server).
Sometimes, especially for things that take some time to run, it might be better to simply open two SSH sessions. With the windows sitting side by side it's easy to monitor just what's happening. I tend to do this a lot when I'm tailing log files while testing things.