Operating System - HP-UX
1832275 Members
2044 Online
110041 Solutions
New Discussion

Is there anyway to refresh dmesg output?

 
zhaogui
Super Advisor

Is there anyway to refresh dmesg output?

Anybody knows if there is anyway to refresh dmesg output to reflect the current status besides rebooting the server?

Thanks,
7 REPLIES 7
Yogeeraj_1
Honored Contributor

Re: Is there anyway to refresh dmesg output?

hi,

you can use dmesg -

See quote from man below:

dmesg looks in a system buffer for recently printed diagnostic
messages and prints them on the standard output. The messages are
those printed by the system when unusual events occur (such as when
system tables overflow or the system crashes). If the - argument is
specified, dmesg computes (incrementally) the new messages since the
last time it was run and places these on the standard output. This is
typically used with cron (see cron(1)) to produce the error log
/var/adm/messages by running the command:

/usr/sbin/dmesg - >> /var/adm/messages

every 10 minutes.




Hope this helps!

Best Regards
yogeeraj
No person was ever honoured for what he received. Honour has been the reward for what he gave (clavin coolidge)
zhaogui
Super Advisor

Re: Is there anyway to refresh dmesg output?

What I mean is to clear all the message in the output of dmesg, Not "dmesg -".
ramesh_6
Frequent Advisor

Re: Is there anyway to refresh dmesg output?

Hi,

There is no command options available in the unix to refresh the dmesg command automatically as we do in sar, vmstat, iostat.

But you can write a small shell script with the command dmesg and run it in cron for the respective interval

The script can look like below

#!/bin/sh
#Beginning of script

echo "##################################" >> /tmp/dmesg.loh
dmesg -c >>/tmp/dmesg.log
echo "##################################" >> /tmp/dmesg.log

# End of script

Name the script as some "xyz.sh" and add the script name in crontab ( Command is crontab-e)

30 * * * * * /xyz.sh

Regds
Ramesh
ramesh_6
Frequent Advisor

Re: Is there anyway to refresh dmesg output?

Hi

dmesg -c will clear the buffer content and hope the above would have solved your queries

Regds
Ramesh
Yogeeraj_1
Honored Contributor

Re: Is there anyway to refresh dmesg output?

Hi,

I tried "dmesg -c"! Does not seem to work!
============================================================
# dmesg -c
# dmesg

Aug 23 12:45
vuseg=52fd000
inet_clts:ok inet_cots:ok 8 ccio
10 ccio
10/0 c720
10/0.1 tgt
10/0.1.0 sdisk
10/0.1.1 sdisk
10/0.1.2 sdisk
10/0.1.3 sdisk
10/0.1.4 sdisk
10/0.3 tgt
10/0.3.0 sdisk
10/0.4 tgt
10/0.4.0 sdisk
10/0.5 tgt
10/0.5.0 sdisk
10/0.6 tgt
10/0.6.0 sdisk
10/0.7 tgt
10/0.7.0 sctl
10/4 bc
10/4/0 mux2
10/4/4 btlan1
10/4/8 btlan1
10/4/16 scsi3
10/4/16.0 target
10/4/16.0.0 disc3
10/4/16.0.1 disc3
10/4/16.0.2 disc3
10/4/16.0.3 disc3
10/4/16.0.4 disc3
10/8 GSCtoPCI
10/8/1/0 gelan
10/12 bus_adapter
10/12/5 c720
10/12/5.0 tgt
10/12/5.0.0 stape
10/12/5.2 tgt
10/12/5.2.0 sdisk
10/12/5.7 tgt
10/12/5.7.0 sctl
10/12/6 lan2
10/12/0 CentIf
ps2_readbyte_timeout: no byte after 500 uSec
ps2_readbyte_timeout: no byte after 500 uSec
10/12/7 ps2
32 processor
34 processor
49 memory
btlan1: Initializing 10/100BASE-T card at 10/4/4.......
btlan1: NOTE: Hub/Switch does not support autonegotiation.
btlan1: NOTE: 100Base-TX started.
btlan1: Initializing 10/100BASE-T card at 10/4/8.......
btlan1: NOTE: Hub/Switch does not support autonegotiation.
btlan1: NOTE: 100Base-TX started.
Networking memory for fragment reassembly is restricted to 80572416 bytes
Logical volume 64, 0x3 configured as ROOT
Logical volume 64, 0x2 configured as SWAP
Logical volume 64, 0x2 configured as DUMP
Swap device table: (start & size given in 512-byte blocks)
entry 0 - major is 64, minor is 0x2; start = 0, size = 1048576
WARNING: Insufficient space on dump device to save full crashdump.
Only 536870912 of 939516928 bytes will be saved.
Dump device table: (start & size given in 1-Kbyte blocks)
entry 0 - major is 31, minor is 0x6000; start = 52064, size = 524288
netisr real-time priority reset to 100
Starting the STREAMS daemons.
9245XB HP-UX (B.10.20) #1: Sun Jun 9 06:31:19 PDT 1996

Memory Information:
physical page size = 4096 bytes, logical page size = 4096 bytes
Physical: 917496 Kbytes, lockable: 668644 Kbytes, available: 770436 Kbytes

#
============================================================

Regards
Yogeeraj
No person was ever honoured for what he received. Honour has been the reward for what he gave (clavin coolidge)
ramesh_6
Frequent Advisor

Re: Is there anyway to refresh dmesg output?

That seems funny that dmesg -c is not working

There is a workaround i found for this.
There is a file by name msg.buf which is used by dmesg.
You can do a null input on that file and run dmseg -c to get a refreshed output

#> /var/adm/msg.buf

#dmesg -

Willl be useful

Regds
Ramesh
Frank Slootweg
Honored Contributor

Re: Is there anyway to refresh dmesg output?

It is not clear what you want to do and why you want to it.

If the question is how to make dmesg to not generate old information, *whatever* you do, then that is not possible.

dmesg processes the system message buffer which is is a FIFO buffer in memory. Whatever you do "dmesg" (*without* the "-" option) will always display the old information in the system message buffer.