Advertisement
Guest User

pwrstatd-email.sh

a guest
Jun 25th, 2011
1,574
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.74 KB | None | 0 0
  1. #
  2. # This is sample script of the send mail for pwrstatd daemon using.
  3. #
  4.  
  5. #!/bin/sh
  6.  
  7. SUBJECT="PowerPanel Notification - [$EVENT]"
  8. MESSAGE="Warning: The $EVENT event has occurred for a while, system will be shutdown immediately!"
  9.  
  10. DATE=`date +'%Y/%m/%d %p %H:%M'`
  11. test ${#DATE}
  12.  
  13. RUNTIME=""
  14.  
  15. if [ $REMAINING_RUNTIME != none ]; then
  16.         RUNTIME="Remaining Runtime: $REMAINING_RUNTIME Seconds"
  17. fi
  18.  
  19. DATA="
  20. ========================================================
  21.   $SUBJECT
  22. ========================================================
  23.  
  24.  
  25. $MESSAGE
  26. Time: $DATE
  27.  
  28. UPS Model Name: $MODEL_NAME
  29. Battery Capacity: $BATTERY_CAPACITY %
  30. $RUNTIME"
  31.  
  32. echo "$DATA" | mail \
  33. -s   "$SUBJECT" \
  34. -r   $SENDER_ADDRESS \
  35.      $RECEIPT_ADDRESS
  36.  
  37. exit 0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement