2

I have a bash script which calls an external program I cannot modify. The first stage of this program uses high IO and the second stage uses almost no IO, instead it uses a lot of CPU, it does not provide any output which indicates which stage it is on. I want to call this program, wait until it's done with the IO-heavy stage, and then continue running the rest of my script. In pseudocode it would be something like this

execute externalscript
while total io for last 30 seconds > 1MB;do sleep 30s;done;continue script
<.. rest of script..>

What methods could I use to monitor the IO? I am familiar with iotop, just wondering if there's a more direct way than parsing its output.

Mr. T
  • 109
  • 2
  • 10
  • 1
    Take a look at https://unix.stackexchange.com/questions/206252/know-which-process-does-i-o-without-iotop . Maybe you can monitor `/proc//io` and see when some of the values there stop going up quickly. - I just looked up "how does iotop work". `pid` is the process id of the external script which can be accessed with `$!` as soon as the external program is launched by your script if the command ends in ` &` so the script isn't waiting for it to complete. – Joe Mar 02 '19 at 07:39

0 Answers0