diff options
Diffstat (limited to 'rescue')
-rw-r--r-- | rescue/NEWS | 2 | ||||
-rw-r--r-- | rescue/grabjournallogs | 51 | ||||
-rw-r--r-- | rescue/list.xml | 1 | ||||
-rw-r--r-- | rescue/tree/etc/issue | 1 |
4 files changed, 55 insertions, 0 deletions
diff --git a/rescue/NEWS b/rescue/NEWS index c134fc33f..e4aea9f46 100644 --- a/rescue/NEWS +++ b/rescue/NEWS @@ -1,3 +1,5 @@ +- add a script to simplfy grabbing of journal logs for bug reports + Version 1.41 - 6 April 2013 by Thierry Vignaud - really adapt to /usr move (fix lvm2 freezing, mga#5795) diff --git a/rescue/grabjournallogs b/rescue/grabjournallogs new file mode 100644 index 000000000..ef2ea4a1d --- /dev/null +++ b/rescue/grabjournallogs @@ -0,0 +1,51 @@ +#!/bin/bash + +if ! mountpoint -q /mnt ; then + echo "I do not seem to see a Mageia install mounted on /mnt. You need to mount it first!" >&2 + exit 1 +fi + +if [ ! -f /mnt/etc/machine-id ]; then + echo "Cannot find machine-id file (/mnt/etc/machine-id)" >&2 + exit 1 +fi + +MID=$(cat /mnt/etc/machine-id) +echo +echo "Found machine-id: $MID" +if [ ! -d /mnt/var/log/journal/$MID ]; then + echo "Cannot find journal log directory (/mnt/var/log/journal/<machine-id>)" >&2 + exit 1 +fi + +TIMEFRAME=24 +if [ -n "$1" ]; then + NEWTIMEFRAME=$(( 0 + $1 )) + if [ $NEWTIMEFRAME -gt 0 ]; then + TIMEFRAME=$NEWTIMEFRAME + fi +fi +SINCE="$(LC_ALL=c date --date=$TIMEFRAME' hours ago' +'%F %T')" +echo "Will collect logs from the last $TIMEFRAME hour(s)" +echo " NB give numeric argument to override capture period" + +TEMPFILE=$(mktemp /tmp/grabjournallogs.XXXXXX) +echo -n "Extracting logs... " +journalctl -D /mnt/var/log/journal/$MID --since "$SINCE" -o short >$TEMPFILE +echo "done" + +if [ $(cat $TEMPFILE | wc -l) -lt 2 ]; then + rm -f $TEMPFILE + echo >&2 + echo "Cannot find any logs. Consider increasing the capture period by passing a" >&2 + echo "numeric argument larger than $TIMEFRAME." >&2 + exit 1 +fi + +echo -n "Compressing logs... " +cat $TEMPFILE | xz >/journallogs.xz +rm -f $TEMPFILE +echo "done" + +echo +echo "Your logs have been extracted to the file 'journallogs.xz'" diff --git a/rescue/list.xml b/rescue/list.xml index c0c88d4a2..8618b8337 100644 --- a/rescue/list.xml +++ b/rescue/list.xml @@ -352,6 +352,7 @@ diskdrake-resize genpasswd startssh + grabjournallogs </to> <to dir="/usr/sbin"> restore-image.sh diff --git a/rescue/tree/etc/issue b/rescue/tree/etc/issue index c5a4c7fb8..11f9f3102 100644 --- a/rescue/tree/etc/issue +++ b/rescue/tree/etc/issue @@ -26,4 +26,5 @@ Use [1;33;40mdrvinst[0m to install drivers according to detected devices Use [1;33;40mlsparts[0m to list your partitions with types Use [1;33;40mstartssh[0m to start an ssh daemon Use [1;33;40mrescue-gui[0m to go back to the rescue menu +Use [1;33;40mgrabjournallogs[0m to grab the last 24 hours of journal logs |