Date: Tue, 29 May 2012 02:35:14 +0000 From: tzabal@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r236633 - soc2012/tzabal/client-side/akcrs-head/usr.sbin/crashreport Message-ID: <20120529023514.A6B471065670@hub.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: tzabal Date: Tue May 29 02:35:14 2012 New Revision: 236633 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=236633 Log: Updated version of /usr/sbin/crashreport. Modified: soc2012/tzabal/client-side/akcrs-head/usr.sbin/crashreport/crashreport.sh Modified: soc2012/tzabal/client-side/akcrs-head/usr.sbin/crashreport/crashreport.sh ============================================================================== --- soc2012/tzabal/client-side/akcrs-head/usr.sbin/crashreport/crashreport.sh Tue May 29 02:35:13 2012 (r236632) +++ soc2012/tzabal/client-side/akcrs-head/usr.sbin/crashreport/crashreport.sh Tue May 29 02:35:14 2012 (r236633) @@ -2,16 +2,16 @@ . /etc/rc.conf + print_usage() { echo "usage: $(basename $0) [-d dumpdir] [-f file] [-e email]" } -# Constants +# Default dump directory DUMPDIR='/var/crash' -# Script variables _dumpdir="" _file="" _email="" @@ -35,19 +35,11 @@ esac done -echo 'We start with:' -echo "_dumpdir = ${_dumpdir}" -echo "_file = ${_file}" -echo "_email = ${_email}" -echo '---------------' -echo 'We end up with:' ## Find the dump directory -# Check the parameter if [ -z "${_dumpdir}" ]; then - # Check the dumpdir of /etc/rc.conf + # dumpdir of /etc/rc.conf if [ -z "${dumpdir}" ]; then - # Use the default dumpdir _dumpdir=${DUMPDIR} else _dumpdir=${dumpdir} @@ -64,16 +56,14 @@ exit 2 fi -echo "_dumpdir = ${_dumpdir}" ## Find the file that contains the debugging information ## It is either a core.txt.X or a textdump.tar.X +X="" BOUNDS="${_dumpdir}/bounds" CORE="${_dumpdir}/core.txt" TEXTDUMP="${_dumpdir}/textdump.tar" -X="" -# Check the parameter if [ -z "${_file}" ]; then # Find it using the file bounds if [ -r "${BOUNDS}" ]; then @@ -86,7 +76,7 @@ fi # Otherwise, use this (heavier) way else - _file=`ls ${_dumpdir} | grep '[a-z]*\.[a-z]*\.\w*' | \ + _file=`ls ${_dumpdir} | egrep '[a-z]+\.[a-z]+\.[0-9]+' | \ sort -n -t . -k 3 | tail -1` fi fi @@ -96,12 +86,10 @@ exit 3 fi -echo "_file = ${_file}" ## Find the email that will be used for contact -# Check the parameter if [ -z "${_email}" ]; then - # The email of /etc/rc.conf + # email of /etc/rc.conf _email="${email}" fi @@ -115,14 +103,24 @@ > /dev/null if [ "$?" -ne "0" ]; then - echo "Email address ${_email} is invalid." + echo "crashreport: Email address ${_email} is invalid." exit 5 fi -echo "_email = ${_email}" -## Send the report -echo 'Sending the report...' +## Bundle the report +report="report.tar" +email_file=`mktemp /tmp/crashreport.XXXXXX` + +echo "${_email}" > ${email_file} +tar -c -f ${report} ${_dumpdir}/${_file} ${email_file} + + +## Send the report to the Central Collector machine +user="reporter" +hostname="akcrs.dyndns.org" +scp -q ${report} ${user}@${hostname}: + -# Everything went smooth +# Everything went smoothly exit 0 \ No newline at end of file
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20120529023514.A6B471065670>