Created
May 10, 2019 13:28
-
-
Save AJDurant/a0cdc566df5b494fa836e3c9c7481e45 to your computer and use it in GitHub Desktop.
Get all boot logs from journalctl and put them into a given dir by boot time
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash -ue | |
| LOGDIR=$1 | |
| # The code point $'\342\200\224' is for the em dash | |
| rm $LOGDIR/*.log | |
| journalctl --list-boots --utc | awk -F $'\342\200\224' '{print $1}' | awk '{print $1, $4"_"$5"_"$6}' | xargs -n2 bash -x -c "journalctl --no-pager -b\$1 > $LOGDIR/\$2.log" bash |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment