daily pastebin goal
4%
SHARE
TWEET

Untitled

a guest Aug 14th, 2012 10 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. xxx-crash-reporter.conf:
  2.  
  3. start on stopped RESULT=failed JOB!=xxx-crash-reporter
  4.  
  5. env NOTIFY_SERVER="http://my.notification.server.com/notify"
  6.  
  7. task
  8. console log
  9.  
  10. script
  11.         case $JOB in
  12.                 xxx-*)
  13.                         sleep 2
  14.                         echo -n "Catching stopped job [$JOB] "
  15.                         date
  16.                         logfile="/var/log/upstart/${JOB}.log"
  17.                         desc_file="$(tempfile)"
  18.                         echo "..." >> $desc_file
  19.                         tail -n $LOG_LINES "$logfile" >> $desc_file
  20.                         echo " -- End of Logfile --" >> $desc_file
  21.                         echo "Submitting notification..."
  22.                         curl --data-urlencode "application=${JOB}" \
  23.                                 --data-urlencode "even=stopped" \
  24.                                 --data-urlencode "description@$desc_file" "$NOTIFY_SERVER"
  25.                         echo "Restarting job..."
  26.                         initctl start ${JOB} || true
  27.                         rm "$desc_file"
  28.                         echo "..done."
  29.                         ;;
  30.                 *)
  31.                         ;;
  32.         esac
  33.        
  34. end script
RAW Paste Data
Pastebin PRO WINTER Special!
Get 40% OFF Pastebin PRO accounts!
Top