notify-job 316 B

1234567891011121314151617
  1. #!/usr/bin/env bash
  2. JOB=$1
  3. COMMANDFILE=$2
  4. ADDRESS=$3
  5. mkdir -p "~/jobs/${JOB}"
  6. /bin/sh "$COMMANDFILE" | tee "~/jobs/${JOB}/output"
  7. mail -s "Your Job is Complete" -a "~/jobs/${JOB}/output" "${ADDRESS}" <<EOF
  8. The output of the command file is attached.
  9. JOB=${JOB}
  10. COMMANDFILE=${COMMANDFILE}
  11. ADDRESS=${ADDRESS}
  12. EOF