node package manager
Stop writing boring code. Discover, share, and reuse within your team. Create a free org »



Build Status

Script runner

Table of Contents


  • Automatically restart process if it crashes
  • Supports workspace
  • Easy to run as a daemon on unix based systems
  • Provides both CLI and Node.js module API
  • Built-in powerful logger system


$ npm install pot-js

For global CLI command, please add -g option

$ npm install -g pot-js

CLI Reference

pot <command> [args]
  start [entry]  Start process
  stop [name]    Stop process
  stopall        Stop all processes
  list           List processes                [aliases: ls]
  log [name]     Show log
  dir [name]     Show dir
  --version   Show version number                  [boolean]
  -h, --help  Show help                            [boolean]

Node.js module API Reference


Spawn a process

  • baseDir (String): The base directory for resolving modules or directories. Defaults to the current working directory
  • name (String): Process monitor name. Defaults to the basename of baseDir.
  • workspace (String): Workspace.
  • entry (String): Defining the source script. Defaults to ./index.js.
  • execArgs (String|[String]): Executing arguments. Defaults to [].
  • execCommand (String): Executing command. Defaults to process.execPath, which returns the absolute pathname of the executable that started the Node.js process. i.e. /usr/local/bin/node.
  • inspect (Boolean|String|Object): Enable node inspector. Defaults to false.
  • logLevel (String|Object): Defining log level. See pot-logger for detail. Here are available levels:
    • ALL
    • TRACE
    • DEBUG (default in development mode)
    • INFO (default in production mode)
    • WARN
    • ERROR
    • FATAL
    • OFF
  • logsDir (String): Defining log files directory. If daemon mode actived, log messages will write to some .log files. Defaults to .logs.
  • maxRestarts (Number): Defining max restarts if crashed. Defaults to -1 (-1 equals to Infinity) in production mode, 0 in development mode.
  • monitorProcessTitle (String): Monitor process title. Defaults to "node".
  • daemon (Boolean): Enable daemon mode. Notice: to kill daemon process, please run claypot stop ${name}. Defaults to false.
  • production (Boolean): Enable production mode. Defaults to true.
  • env (Object): Defining custom environments. Defaults to process.env.
  • cwd (String): Defining the current working directory. Defaults to process.cwd().
  • watch (Boolean|Object): Enable watch mode. Defaults to false. Here are available props for object config:
    • enable (Boolean): Enable watch. Defaults to true.
    • dirs (String|[String]): Defining watching directories.
    • ignoreDotFiles (Boolean): Ignore watching .* files. Defaults to true.
    • ignoreNodeModulesDir (Boolean): Ignore watching node_modules directory. Defaults to true.
  • configToEnv (String): Setting an env name and pass the config json string to child process env.


Stop a process

  • name (String): Target process name.
  • workspace (String): Workspace.
  • force (Boolean): Force stopping without confirmation. Defaults to false.


Stop all processes

  • workspace (String): Workspace.
  • force (Boolean): Force stopping without confirmation. Defaults to false.


List running processes

  • workspace (String): Workspace.


Displaying the last part of a process log files

  • name (String): Target process name.
  • workspace (String): Workspace.
  • category (String): The category of log files.
  • line (Number): The max lines of log messages. Defaults to 200.


Displaying the directory of a pot process project.

  • name (String): Target process name.
  • workspace (String): Workspace.