Tuesday, 30 May 2017

Determine when a server was last rebooted / shutdown

Using the utility 'last' we can quickly identify when a server was rebooted or shutdown and by whom - of course you can do this by digging through syslog - however this provides a quick alternative.

We should issue:

sudo last -wxF

Example output:

user2   pts/0        5.6.7.8     Tue May 30 09:28:11 2017   still logged in
runlevel (to lvl 2)   3.XX.X-XX-generic Mon May 29 22:49:26 2017 - Tue May 30 09:44:59 2017  (10:55)
reboot   system boot  3.XX.X-XX-generic Mon May 29 22:49:26 2017 - Tue May 30 09:44:59 2017  (10:55)
user   pts/2        1.2.3.4     Mon May 29 08:37:32 2017 - Mon May 29 10:48:27 2017  (02:10)
user   pts/2        1.2.3.4     Thu May 25 12:37:50 2017 - Thu May 25 17:42:15 2017  (05:04)
user   pts/2        1.2.3.4     Mon May 15 08:38:54 2017 - Mon May 15 10:44:46 2017  (02:05)
user   pts/2        1.2.3.4     Tue May  9 08:32:44 2017 - Tue May  9 10:34:29 2017  (02:01)
user   pts/3        1.2.3.4     Tue May  9 08:28:45 2017 - Tue May  9 10:31:14 2017  (02:02)
user   pts/3        1.2.3.4     Tue May  9 07:51:54 2017 - Tue May  9 07:51:56 2017  (00:00)
user   pts/3        1.2.3.4     Tue May  9 07:49:07 2017 - Tue May  9 07:50:53 2017  (00:01)
user   pts/2        1.2.3.4     Tue May  9 07:22:15 2017 - Tue May  9 08:32:39 2017  (01:10)
user   pts/2        1.2.3.4     Mon May  8 05:50:01 2017 - Mon May  8 07:59:39 2017  (02:09)
user   pts/2        1.2.3.4     Fri May  5 10:57:47 2017 - Fri May  5 13:06:11 2017  (02:08)
user   pts/2        1.2.3.4     Thu May  4 11:33:05 2017 - Thu May  4 13:36:59 2017  (02:03)
user   pts/2        1.2.3.4     Thu May  4 09:10:16 2017 - Thu May  4 11:19:01 2017  (02:08)

0 comments:

Post a Comment