SaveX11crash.sh added

This commit is contained in:
Ulf 2021-11-22 21:52:34 +01:00
parent c0d76d02c5
commit b9db7d80ec
2 changed files with 34 additions and 0 deletions

View file

@ -15,6 +15,7 @@ See also at [LUG-VS-Wiki Nützliche Scripte](https://lug-vs.org//lugvswiki/index
|[duc-index.sh](duc-index.sh)|Script to be added e.g. as cronjob, which generate an index w/o NFS and DavFS file system mounted files| |[duc-index.sh](duc-index.sh)|Script to be added e.g. as cronjob, which generate an index w/o NFS and DavFS file system mounted files|
|[make_exif-name.sh](make_exif-name.sh)|Add a comment in all *.jpg files in the actual and all subfolders| |[make_exif-name.sh](make_exif-name.sh)|Add a comment in all *.jpg files in the actual and all subfolders|
|[SavePC.sh](SavePC.sh)|Save some helpfull settings (not /home) and some general informatin| |[SavePC.sh](SavePC.sh)|Save some helpfull settings (not /home) and some general informatin|
|[SaveX11crash.sh](SaveX11crash.sh)|Save the X11 logs and the journalctl of the last 10 minutes|
|[SchredderHDD.sh](SchredderHDD.sh)|Delete a mechanical Hard Disk (HDD) reliably to ensure before forward it to the recycling, that no old data are there| |[SchredderHDD.sh](SchredderHDD.sh)|Delete a mechanical Hard Disk (HDD) reliably to ensure before forward it to the recycling, that no old data are there|
|[utf8.sh](utf8.sh)|Convert text from e.g. Windows latin1 to utf8 text (e.g. in READMEs or other text (not for office documents))| |[utf8.sh](utf8.sh)|Convert text from e.g. Windows latin1 to utf8 text (e.g. in READMEs or other text (not for office documents))|
|[wmf2svg.sh](wmf2svg.sh)|Example script converts WMF files in SVG to share it easily on the internet| |[wmf2svg.sh](wmf2svg.sh)|Example script converts WMF files in SVG to share it easily on the internet|

33
SaveX11crash.sh Executable file
View file

@ -0,0 +1,33 @@
#!/bin/bash
# SaveX11crash.sh save the X11 logs and the journalctl of the last 10 minutes
#
# (c) GPL by Ulf Bartholomäus ub1x@gmx.net
VERSION="$( basename $0 ) Version 0.1.0 from 22.11.2021"
#
# Input: n/a
# Output: progress and 7z compressed logs
# Returnvalue: 0 if finished OK and 10 if there was an issue at 7z
#
## Verwendeten Pfad mit Datum und Uhrzeit definieren - da sich die Sekunden ändern könnten
MyPath="${HOME}/X11-Crash_$(date +%F_%H-%M-%S)"
MyTime="-10m" # -10m = die letzten 10 minuten
## Pfad anlegen
mkdir -p ${MyPath}
## X11 Logs in aktuellen Pfad Sichern sowie journal der letzten 10min erstellen
echo -e "Sicher X11 logs:"
cp -v /var/log/Xorg.* ${MyPath}/
journalctl -xe --since ${MyTime} >> ${MyPath}/journalctl_${MyTime}.log
echo -e "Sicher journalctl von <${MyTime}>"
## Packe die Logs und mache es für alle änderbar (exit falls Problem)
7za a "${MyPath}.7z" "${MyPath}" || exit 10
## Ordner wieder löschen und rechte auf für alle lese und schreibbar
rm -rf "${MyPath}"
chmod a+rw "${MyPath}.7z"
## Verschiebe 7z
echo -e "Verschieb Logs in </tmp> damit auch für normale Benutzer zugreifbar zu machen"
mv -v "${MyPath}.7z" /tmp