Code Monkey home page Code Monkey logo

idle's Introduction

Name

idle - Run processes based on processor idle state

Synopsis

idle -hksvz -i secs -t percent -- /path/to/command [args]

Description

The idle program allows for processes to be started and stopped based on the processor idle state. Through a combination of command line arguments, it can start a user-specified process when the processor idle, as reported by /proc/stat and expressed as a percentage of overall processor execution time, exceeds a specified threshold. If the processor idle subsequently drops below this threshold, the user-specified process can be either terminated or suspended.

The user specified command should appear on the command-line, with all command-line parameters as required for execution, after parameters passed to the idle application and a "--" separator. While the full path to the user-specified application should be specified, the idle application will search the current PATH environment variable for the matching executable if no path is specified.

Options

-i secs Configures interval time across which processor execution time is measured. The interval time is measured in seconds and is expected to be an integer value. The default interval is 30 seconds.

-t percent Configures the trigger threshold of idle time as a percentage of overall processor execution time at which the user-specified process should be started and stopped. The default trigger threshold is 90.0% processor idle time.

-k Sets the program to terminate the user-specified process using the KILL signal when the processor idle time drops below the trigger threshold. The use of this signal ensures termination of the user-specified process, but does not provide it with any opportunity to perform clean-up operations.

-s Sets the program to terminate the user-specified process using a TERM signal when the processor idle time drops below the trigger threshold. This is the default mode of operations.

-z Sets the program to suspend the user-specified process using a STOP signal when the processor idle time drops below the trigger threshold. Operations of the user-specified process are resumed through the issue of a CONT signal when the processor idle time again exceeds the trigger threshold. This mode of operations is incompatible with the -k and -s command line options.

-v Displays verbose program output.

-h Displays program usage message.

Examples

Logging system idle time

idle -i 300 -t 90 -- logger -p daemon.info "System is idle"

Writes "System is idle" to the system log whenever processor idle time exceeds 90% over a 5 minute polling period.

Running resource intensive processes

idle -i 30 -t 75 -z -- updatedb -l 0 -o ~/.mlocate.db -U ~

Update a private mlocate database for the local user where the processor idle time exceeds 75% over a 30 second polling period. If the processor idle time drops below this threshold on subsequent polling, the updatedb process will be suspended using a STOP signal and then resumed with a CONT signal once processor idle time again exceeds this 75% threshold. The expectation is that this is a command which would be combined with a cron-job for scheduled execution.

Author

Rob Casey [email protected]

See Also

kill

idle's People

Contributors

61131 avatar

Stargazers

 avatar  avatar

Watchers

 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.