Note that the ACTION variable will need to be customized before you run this script. As you can see, it doesn't actually do anything drastic by default, and if you don't have a mail user named greg, it won't do anything useful either.
Make sure you run it as the appropriate user. If you want it to stop your node, make sure it has permission to do so. Such arrangements are your responsibility as the node operator.