Just been supporting someone remotely and was waiting for them to turn on their laptop…

Whilst troubleshooting I ran uptime to see how long we’d been working on the problem and saw it was up for ~2 weeks…

Which made me think … how do you tell how long a device (laptop) has been running, but since it’s last suspend / hibernation?

I can find it from other clues such as journalctl -b -fu systemd-logind and look for Lid opened, but I was really looking for an smarter way…

Just a nice little challenge for anyone bored at this time of year :)

  • HelloRoot@lemy.lol
    link
    fedilink
    English
    arrow-up
    8
    ·
    edit-2
    18 days ago
    journalctl --list-boots
    

    If you see multiple entries without reboots, those intermediate boundaries are suspend/resume cycles.

    you can get the last resupe time with either

    journalctl -b -1 -g "PM: suspend exit"
    

    or maybe

    journalctl -g "resume from suspend"
    

    I don’t have my laptop with me rn, so it would be nice if somebody can confirm whether this works

    • SayCyberOnceMore@feddit.ukOP
      link
      fedilink
      English
      arrow-up
      2
      ·
      17 days ago

      Thanks, yeah, it looks like the journal is the main way.

      I was also trying last and who, but they didn’t help

      And I was hoping there would be an easy systemd approach