ZREP replication and failover. Rewriting from ksh to sh, taked from http://www.bolthole.com/solaris/zrep/