Giter Site home page Giter Site logo

kidyfirst / resume.js Goto Github PK

View Code? Open in Web Editor NEW

This project forked from csonlai/resume.js

0.0 1.0 0.0 352 KB

Resume.js is a simple CLI process manager to manager your node processes,and auto restart your process when exit.

JavaScript 100.00%

resume.js's Introduction

Resume.js

Resume.js is a simple CLI process manager to manager your node processes,and auto restart your process when exit.

Installation

   [sudo] npm install -g cli-resumejs

How it works

Resume.js let you manage your processes with commands,which communicate with different processes base on UNIX domain socket.

Commands

We can use resume -h to get all commands support

    resume -h
  Usage: resume resume [options]

  Options:

    -h, --help            output usage information
    -V, --version         output the version number
    -r, --run <filename>  run a process which will resume itself when broke.
    -l, --list            list all processes.
    -R, --restart <pid>   restart a running process.
    -s, --stop <pid>      stop a running process
    -L, --log <ppid>      show the log of a resume process

  Examples:

    $ resume -r ./serverA.js
    $ resume -r ./serverB.js
    $ resume -l

Simple Example

Run a node process with resume.js with -r command

    resume -r ./example.js

Then we can list our processes with -l command

    resume -l 
PID    | PPID   | Process Name  | Start Time       | Log File
-------| ------------------------------------------| ---------------------------------------------
1030   | 1026   | ./example.js  | 02 2014 17:50:55 | /Users/cson/.resume/log/1414921836441.log
1036   | 1028   | ./example2.js | 02 2014 17:55:52 | /Users/cson/.resume/log/1414921836782.log

Use -R command to restart a process

    resume -R 1030
    Restart progress 1030 success!

Use -s command to stop a process

    resume -s 1036
    Stop progress 1036 success!

We can also show the log of a process with -L command

    resume -L 975
    Sun Nov 02 2014 17:40:58 GMT+0800 (HKT)
    Run child process ../example/example.js(968) success!
    
    Sun Nov 02 2014 17:41:19 GMT+0800 (HKT)
    child process ../example/example.js(968) exit!
    
    Sun Nov 02 2014 17:41:19 GMT+0800 (HKT)
    Restart child process ../example/example.js(971)
    
    Sun Nov 02 2014 17:41:48 GMT+0800 (HKT)
    child process ../example/example.js(971) exit!
    
    Sun Nov 02 2014 17:41:48 GMT+0800 (HKT)
    Restart child process ../example/example.js(975)

Auto Restart Example

When your process exit ,resume.js will auto restart it ,let your prcess run forever.

Firstly,list all processes:

    resume -l
  
    PID    | PPID   | Process Name  | Start Time       | Log File
    -------| ------------------------------------------| ---------------------------------------------
    1030   | 1026   | ./example.js  | 02 2014 17:50:55 | /Users/cson/.resume/log/1414921836441.log

Then we kill the process with kill command:

    kill -s SIGKILL 1030

Fianlly,list all processes again,and we will see the process has auto restarted:

  
    PID    | PPID   | Process Name  | Start Time       | Log File
    -------| ------------------------------------------| ---------------------------------------------
    1053   | 1026   | ./example.js  | 02 2014 18:09:01 | /Users/cson/.resume/log/1414921836441.log

resume.js's People

Contributors

csonlai avatar

Watchers

James Cloos 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.