How to reboot multiple times and store dmesg logs with single script?

Hello, I want to store dmesg logs after booting and reboot the system and again I want to store dmesg log and reboot with script. can anyone give me Idea on how to implement this with script?

Store where?

In text file

Well yeah, but where?

@frollic In my VOCORE2 board

Still not answering the question, on what media.

In VOCOREs 16M NOR on board

Assuming frequent writes won't kill the flash, create a K01.writelog script in /etc/rc.d, piping dmesg to a file.

2 Likes

what about Implementing reboot?How to to implement it for n number of times?

uci-defaults, get it right as infinity is a long ways from here abouts.

Concatenate, or add date and time to the file name?

1 Like

add date and time to filename

Use the date command to format a date and timestamp.

2 Likes

@anomeome I tried to follow the link you shared, to run script after every boot I just return 1 instead 0, but after saving "reboot_script" file in /etc/uci-defaults and after rebooting, "reboot_script" does not exists anymore.
and even reboot is not happening