Script to check battery status. 

If the battery gets 50% or less, an email is send. If the battery gets below 30%, shutdown is initiated and some devices are turned off.