# process_status

> A utility to get process information for given process name

Latest version **0.0.2** (published 2012-10-02) · 0 weekly downloads

## Install

```sh
npm install process_status
pnpm add process_status
yarn add process_status
bun add process_status
```

## Health

**Score 10/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; low quality score; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.2 |
| Published | 2012-10-02 |
| First published | 2012-09-18 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >= 0.8.6 |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | swright |
| Maintainers | rhythmicdevil |
| Keywords | ps, status, linux process, util |

## Links

- npm: https://www.npmjs.com/package/process_status
- Homepage: https://github.com/rhythmicdevil/process_status
- npm.io page: https://npm.io/package/process_status

## Dependencies (1)

- [underscore](https://npm.io/package/underscore.md) >= 1.2.2

## Alternatives

- [lodash.assign](https://npm.io/package/lodash.assign.md) — 2.3M weekly downloads
- [lodash.chunk](https://npm.io/package/lodash.chunk.md) — 1.8M weekly downloads
- [react-native-ios-utilities](https://npm.io/package/react-native-ios-utilities.md) — 138.5K weekly downloads
- [@technically/lodash](https://npm.io/package/@technically/lodash.md) — 50.9K weekly downloads
- [@fluid-topics/ft-icon](https://npm.io/package/@fluid-topics/ft-icon.md) — 20.6K weekly downloads

## Recent versions

- 0.0.2 (latest) — 2012-10-02
- 0.0.1 — 2012-09-18

## README

process_status
==============

I needed to display process information on a status page in a dashboard. From 
the command line I would type something like:
```Javascript
$ ps -ef | grep httpd
root      3199     1  0 Sep17 ?        00:00:00 /usr/sbin/httpd
apache    3252  3199  0 Sep17 ?        00:00:00 /usr/sbin/httpd
apache    3253  3199  0 Sep17 ?        00:00:00 /usr/sbin/httpd
apache    3254  3199  0 Sep17 ?        00:00:00 /usr/sbin/httpd
apache    3255  3199  0 Sep17 ?        00:00:00 /usr/sbin/httpd
apache    3256  3199  0 Sep17 ?        00:00:00 /usr/sbin/httpd
apache    3257  3199  0 Sep17 ?        00:00:00 /usr/sbin/httpd
apache    3258  3199  0 Sep17 ?        00:00:00 /usr/sbin/httpd
apache    3259  3199  0 Sep17 ?        00:00:00 /usr/sbin/httpd
swright  10615  8615  0 14:51 pts/1    00:00:00 grep httpd
```

The process_status utility runs something like that with some formatting options
and returns an object containing something like the following:

```Javascript
{ grep_str: 'httpd',
  user_format: [],
  pid: '3199',
  pgid: '3199',
  format_str: '%U%p%r%a',
  processes:
   [ 'root      3199  3199 /usr/sbin/httpd',
     'apache    3252  3199 /usr/sbin/httpd',
     'apache    3253  3199 /usr/sbin/httpd',
     'apache    3254  3199 /usr/sbin/httpd',
     'apache    3255  3199 /usr/sbin/httpd',
     'apache    3256  3199 /usr/sbin/httpd',
     'apache    3257  3199 /usr/sbin/httpd',
     'apache    3258  3199 /usr/sbin/httpd',
     'apache    3259  3199 /usr/sbin/httpd' ],
  format_array: [ 'user', 'pid', 'pgid', 'args' ],
  formatted_process_list:
   [ [ 'root', '3199', '3199', '/usr/sbin/httpd' ],
     [ 'apache', '3252', '3199', '/usr/sbin/httpd' ],
     [ 'apache', '3253', '3199', '/usr/sbin/httpd' ],
     [ 'apache', '3254', '3199', '/usr/sbin/httpd' ],
     [ 'apache', '3255', '3199', '/usr/sbin/httpd' ],
     [ 'apache', '3256', '3199', '/usr/sbin/httpd' ],
     [ 'apache', '3257', '3199', '/usr/sbin/httpd' ],
     [ 'apache', '3258', '3199', '/usr/sbin/httpd' ],
     [ 'apache', '3259', '3199', '/usr/sbin/httpd' ] ] }
```

You can then use the display the data using the processes array or for prettier
output you can use the formatted_process_list array to generate a table and the 
format_array to generate table headers.



Usage:
```Javascript
/**
*  Finds a process based on the grep string
*  
*  @param  grep_str    a string that will be used to grep the process list
*  @param   user_format     an array of friendly strings that will be used to 
*                           get string formatters from the formatters array
*  @param   cb              callback  
*/
get_status(grep_str, user_format, cb)
```

To generate the formatted_process_list array 
```Javascript
/**
* @param   status      A status object created by get_status
* @param   cb          A callback function
*/
process_status_data(status, cb)
```

See the test.js file for an implementation example.

---
_Source: https://npm.io/package/process_status · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
