mail.sh 446 B

1234567891011121314151617181920
  1. #!/bin/bash
  2. #
  3. # Example: send a mail
  4. #
  5. sendlogmail(){
  6. local SUBJECT="A meaningful subject: Simulation crashed!"
  7. local DATEFMT="$(date -d "today" "+%Y %b %e, %R")"
  8. local RECIPIENT="$1"
  9. RECIPIENT="${RECIPIENT:-user@example}"
  10. local MAILBODY="Your simulation is crashed due to unknow errors!"
  11. echo -e "Subject: $SUBJECT - $DATEFMT \nTo: $RECIPIENT \n$MAILBODY" | \
  12. /usr/sbin/sendmail "$RECIPIENT"
  13. }
  14. sendlogmail "$1"