Skip to content

on-org/on-process-manager

Repository files navigation

NODE PROCESS MANAGER

it's example for node process manager

This is a TypeScript file that exports a class ProcessManager which can start and stop processes. The file also includes code to install the process manager as a systemd service and run it with command-line options.

Here is a brief overview of the file:

  • The ProcessManager class is defined, which has methods to start and stop processes.
  • The install and remove commands are defined for installing and removing the process manager as a systemd service.
  • The run command is defined for running the process manager with command-line options.
  • The findProcess, startProcess, and removeProcess methods are defined for finding, starting, and removing processes.
  • The logger is defined for logging messages to the console and a log file.
  • The ProcessManager class keeps track of the processes it starts and can stop them all at once. It also has a logger property for logging messages to the console and a log file.

The findProcess method searches for a process by name and its arguments and returns its PID. The startProcess method starts a new process with a given command and arguments. If a process with the same command and arguments is already running, it is killed before starting a new one. The removeProcess method removes a process from the list of running processes.

The install and remove commands use the Autostart class to add and remove the process manager as a systemd service.

The run command creates a ProcessManager instance and starts all the processes defined in a configuration file. The configuration file can be specified with the -c option, and the path to the configuration file can be specified with the -p option. If the -c option is not used, the configuration file config.process.json in the current working directory is used. If the -p option is not used, the current working directory is used.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published