rewrite scheduler script