Giter VIP home page Giter VIP logo

runtime's Introduction

RUNTIME - A tool to track the total uptime of a system

runtime monitors and manages the total uptime of your system. This is achieved by adding up all individual uptimes of the system, thus resulting in a total 'runtime'.

To do this, runtime should be launched after every boot of the system in 'track' mode (see Command line Options). It will then wait until the system is shutdown, read the uptime from /proc/uptime (default), read /var/cache/runtime, add the two values together and save the result to /var/cache/runtime.

Installation

Note: runtime currently requires systemd To install runtime, you first need to compile it.

$ cd /tmp;
$ git clone https://github.com/jacksgt/runtime;
$ cd runtime;
$ make # or alternatively: $ gcc -lm main.c print.c io.c -o runtime
$ sudo cp runtime.service /etc/systemd/system/
$ sudo systemctl enable runtime # runtime will now automatically start after boot
$ sudo cp runtime /usr/local/bin

How do I use runtime?

After you have set up runtime to run in the background, runtime can report the runtime and uptime of the system:

$ runtime --seconds # shows the runtime in seconds
$ runtime --uptime # shows the uptime
$ runtime # or alternatively: runtime --runtime

For more options please have a look at Command line Arguments

But what happens when my computer crashes?

No worries, runtime got your back: it keeps a cache of the uptime. This means after booting the program sleeps for a while (1 hour by default), then write this value (3600 seconds) to /var/cache/runtime_cache and sleep again (and so and and so forth). This way when the computer crashes after 6 hours and 30 minutes of uptime, runtime will read the value of /var/cache/runtime_cache and at least know there were 6 hours worth of uptime. runtime will then add this value to /var/cache/runtime and move on.

Command line Options

Use runtime [option] where valid options are:

    --verbose (not yet functional)
    --version
    --help
    --save
    --track
    --seconds
    --uptime
    --runtime (the default option)

Bugs & Features

If you find a bug, please don't keep, but share it! I'd love to fix it. Also, if you have an suggestions or feature request, just speak up.

runtime's People

Watchers

James Cloos avatar Jack Henschel 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.