Skip to content
/ lights Public

A simple process manager for any executable. Lights. Camera. Action.

Notifications You must be signed in to change notification settings

ableinc/lights

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Lights

A simple process manager for any executable. Lights. Camera. Action.

Usage

Usage: lights [options]
Options:
  -action string
    	Whether to run the lights ON or OFF (start or stop processes).
  -binary string
    	Binary to execute process (default "bun")
  -cameras int
    	Number of processes to run based on number of CPUs on machine. (default 1)
  -name string
    	Name of the process
  -process string
    	Process to execute

Start Process

lights -cameras 2 -action ON -name server -process test.ts

Example:

dev@M2-Air lights % ./lights -cameras 2 -action ON -name server -process
Executing: bun test.ts
Executing: bun test.ts
[ON] Process took: 4.713084ms

Stop Process

lights -action OFF -name server

Example:

dev@M2-Air lights % ./lights -action OFF -name server
[server] Killed process 26702
[server] Killed process 26703
[OFF] Process took: 557.25µs

List Processes

lights list

or

lights list server

Example:

dev@M2-Air lights % ./lights list
Name   CPU(%) MEMORY(MB) Uptime
server 0.00   23.48      3.978249s
server 0.00   23.33      3.984656s
[list] Process took: 10.734667ms

Build From Source

  1. Clone directory and Build
go build cmd/lights/lights.go
  1. Create directory
.lights/
  |-- bin/
    |-- lights
  1. Add binary to bin directory - created in step 2

  2. Add to PATH (this example is for .zshrc)

export LIGHTS_INSTALL="$HOME/.lights"
export PATH="$LIGHTS_INSTALL/bin:$PATH"
  1. Reload source
source ~/.zshrc

Notes

This is a lightweight implementation of a basic process manager. A few things it doesn't do, but could with little effort:

  • Pipe all process logs into one unified log
  • Reload a process, rather than stopping and starting (restart)
  • Pass environment variables into process

About

A simple process manager for any executable. Lights. Camera. Action.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages