Script to monitor and bootstrap a cluster

At the moment when I need to bootstrap a cluster, what I need to do is:
[LIST]
[]Make sure everything is down (including my monit)
[
]Check the grastrate.dat to find which one has the maximum sequence number
[]Set the safe_to_bootstrap flag
[
]/etc/init.d/mysql bootstrap-pxc
[]Wait for that to come up.
[
]If it was successful, start the other nodes one at a time, waiting for the SST to complete on each
[/LIST] Has anyone done any automation of this kind of thing?