Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there an identifier in Linux for the current boot?

My application needs to know if the system has rebooted since the last time it was run. The current strategy I have is to persist a reboot ID that I generate with the following command:

last -f /var/run/utmp | egrep '^reboot' | md5sum | cut -d' ' -f1

Any other ideas?

like image 788
Alan Jones Avatar asked Nov 14 '25 19:11

Alan Jones


1 Answers

Linux kernel exports a unique identifier after each boot:

$ cat /proc/sys/kernel/random/boot_id
a30d49a3-612e-1132-a2b7-c34r01c5ed1r
like image 152
Rfraile Avatar answered Nov 17 '25 17:11

Rfraile



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!