Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- xxx-crash-reporter.conf:
- start on stopped RESULT=failed JOB!=xxx-crash-reporter
- env NOTIFY_SERVER="http://my.notification.server.com/notify"
- task
- console log
- script
- case $JOB in
- xxx-*)
- sleep 2
- echo -n "Catching stopped job [$JOB] "
- date
- logfile="/var/log/upstart/${JOB}.log"
- desc_file="$(tempfile)"
- echo "..." >> $desc_file
- tail -n $LOG_LINES "$logfile" >> $desc_file
- echo " -- End of Logfile --" >> $desc_file
- echo "Submitting notification..."
- curl --data-urlencode "application=${JOB}" \
- --data-urlencode "even=stopped" \
- --data-urlencode "description@$desc_file" "$NOTIFY_SERVER"
- echo "Restarting job..."
- initctl start ${JOB} || true
- rm "$desc_file"
- echo "..done."
- ;;
- *)
- ;;
- esac
- end script
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement