That script might do with the "-w" parameter passed to scrub. Then "zpool scrub" won't return until the scrub is finished.