HP StorageWorks Storage Mirroring Recover Scripting Guide (T5437-96009, November 2009)
173 of 332
Controlling a mirror using flow control
The following script uses the IF conditional, FOR loop, and WHILE loop commands. In
the following examples the FOR loop will start a mirror for all connections between 1 and
10. The IF conditional will return the error command "mirror failed to start" if a value of 0
is not obtained. The WHILE loop will wait for a mirror to end and disconnect as long as
the returned value is less than 10. The IF conditional will return the error message "failed
to disconnect" if a value of 0 is not obtained.
# Start mirror for all connections 1-10. #
# Notify user of any errors. #
SOURCE alpha;
FOR $x = 1 TO 10 DO
$ret = MIRROR START $x;
IF $ret != 0 THEN
WRITE "Mirror failed to start";
WRITE $x;
WRITE $ret;
END
END
# Wait for mirror to end and disconnect all connections 1-10. #
# Notify user of any errors. #
SOURCE alpha;
$x = 1;
WHILE $x <= 10 DO
waitonmirror $x;
$ret = disconnect $X;
IF $ret != 0 THEN
WRITE "Failed to disconnect";
WRITE $x;
WRITE $ret;
END
$x = $x + 1;
END