Code Monkey home page Code Monkey logo

lastwake.rs's Introduction

lastwake.rs

This tool queries the systemd journald for events related to boot/sleep/wake/shutdown and prints a nice summary of the awake times of the machine:

$ lastwake

boot d190acb49b474d5e94c13ae12fd3c04d on 2019-09-05 08:44:22.823888 +02:00
|    Wake at       |      Sleep at    | Awake For | Type  |
| ---------------- | ---------------- | --------- | ----- |
| 2019-09-05 08:44 | 2019-09-05 10:40 |     01:56 | Boot => Sleep |
| 2019-09-05 11:04 | 2019-09-05 12:55 |     01:50 | WakeUp => Sleep |
| 2019-09-05 14:02 | 2019-09-05 15:32 |     01:30 | WakeUp => Sleep |
| 2019-09-05 15:36 | 2019-09-05 16:03 |     00:27 | WakeUp => Sleep |
| 2019-09-05 16:35 | 2019-09-05 18:09 |     01:34 | WakeUp => Sleep |
| 2019-09-06 08:42 | 2019-09-06 12:03 |     03:21 | WakeUp => Sleep |
| 2019-09-06 12:20 | 2019-09-06 15:31 |     03:10 | WakeUp => Sleep |
| 2019-09-07 15:44 | 2019-09-07 16:25 |     00:41 | WakeUp => Sleep |
| 2019-09-07 16:27 | 2019-09-07 17:37 |     01:10 | WakeUp => Shutdown |

This tool is my rust port of the lastwake.py script, with some additional features I use:

  • Relative boot ids: lastwake -2 (second to last boot, same as with journalctl -b)
  • Daily mode: lastwake -d (summarize per day)
  • From-To slice syntax:
    • With boots lastwake -2 -4 (boots -2, -3 and -4)
    • With days lastwake -d 2019-10-07 2 or equivalently lastwake -d 2019-10-07 2019-10-08

Known Issues

  • Daily mode is buggy as hell...

Installation

cargo install --force --git https://github.com/f0rki/lastwake.rs

lastwake.rs's People

Contributors

f0rki avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.