Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/sh
- ### Parameters ###
- logfile="/tmp/ups_report.tmp"
- email="your_email@gmail.com"
- subject="UPS Status Report for FreeNAS"
- ups="ups@localhost"
- ### Set email headers ###
- (
- echo "To: ${email}"
- echo "Subject: ${subject}"
- echo "Content-Type: text/html"
- echo "MIME-Version: 1.0"
- echo -e "\r\n"
- ) > ${logfile}
- ### Set email body ###
- (
- echo "<pre style=\"font-size:14px\">"
- echo ""
- date "+Time: %Y-%m-%d %H:%M:%S"
- echo "UPS Status: `upsc ${ups} ups.status`"
- echo "Output Load: `upsc ${ups} ups.load` %"
- echo "Output Voltage: `upsc ${ups} output.voltage` V"
- echo "Battery Runtime: `upsc ${ups} battery.runtime` s"
- echo "Battery Charge: `upsc ${ups} battery.charge` %"
- echo ""
- echo "</pre>"
- ) >> ${logfile}
- ### Send report ###
- sendmail -t < ${logfile}
- rm ${logfile}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement