1eda14cbcSMatt Macy#!/bin/ksh -p 261145dc2SMartin Matuska# SPDX-License-Identifier: CDDL-1.0 3eda14cbcSMatt Macy 4eda14cbcSMatt Macy# 5eda14cbcSMatt Macy# This file and its contents are supplied under the terms of the 6eda14cbcSMatt Macy# Common Development and Distribution License ("CDDL"), version 1.0. 7eda14cbcSMatt Macy# You may only use this file in accordance with the terms of version 8eda14cbcSMatt Macy# 1.0 of the CDDL. 9eda14cbcSMatt Macy# 10eda14cbcSMatt Macy# A full copy of the text of the CDDL should have accompanied this 11eda14cbcSMatt Macy# source. A copy of the CDDL is also available via the Internet at 12eda14cbcSMatt Macy# http://www.illumos.org/license/CDDL. 13eda14cbcSMatt Macy# 14eda14cbcSMatt Macy 15eda14cbcSMatt Macy# 16eda14cbcSMatt Macy# Copyright (c) 2016 by Delphix. All rights reserved. 17eda14cbcSMatt Macy# Copyright (c) 2017 Lawrence Livermore National Security, LLC. 18*df58e8b1SMartin Matuska# Copyright (c) 2025, Klara, Inc. 19eda14cbcSMatt Macy# 20eda14cbcSMatt Macy 21eda14cbcSMatt Macy# $1: number of lines to output (default: 200) 22eda14cbcSMatt Macytypeset lines=${1:-200} 23eda14cbcSMatt Macy 24eda14cbcSMatt Macyecho "=================================================================" 25eda14cbcSMatt Macyecho " Tailing last $lines lines of dmesg log" 26eda14cbcSMatt Macyecho "=================================================================" 27eda14cbcSMatt Macy 282a58b312SMartin Matuska# report and reset afterwards 29*df58e8b1SMartin Matuskadmesg_args="-c" 30*df58e8b1SMartin Matuskaif [[ $(uname) = "Linux" ]] ; then 31*df58e8b1SMartin Matuska dmesg_args="$dmesg_args --time-format=iso" 32*df58e8b1SMartin Matuskafi 33*df58e8b1SMartin Matuskasudo dmesg $dmesg_args | tail -n $lines 34eda14cbcSMatt Macy 35eda14cbcSMatt Macyecho "=================================================================" 36eda14cbcSMatt Macyecho " End of dmesg log" 37eda14cbcSMatt Macyecho "=================================================================" 38