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