HP StorageWorks Storage Mirroring for Linux User's Guide (T2558-96078, February 2008)

A - 44
Basic flow control script
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 indy;
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 indy;
$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