This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (pypi.python.org).
Help us improve Python packaging - Donate today!
Project Description

nocrux – a painless per-user daemon manager.

Installation

The nocrux daemon manager is available via Pip and Node.py. Minimum version required is Python 3.4. It has been tested on Ubuntu 15.05 and macOS Sierra.

$ nodepy-pm install @NiklasRosenstein/nocrux  #or
$ pip3 install nocrux

Configuration

The configuration file is loaded from ~/.nocrux/conf or /etc/nocrux/conf (preferring the former over the latter). The syntax is similar to what you know from NGinx.

## Directory where the default daemon files are stored. Defaults to
## /var/run/nocrux if the configuration file is read from /etc/nocrux/conf,
## otherwise defaults to ~/.nocrux/run .
#root ~/.nocrux/run;

## The timeout after which a process will be killed when it can not
## be terminated with SIGINT.
#kill_timeout 10;

## Include all files in the conf.d directory relative to the
## configuration file.
include conf.d/*;

## Defines a daemon.
daemon test {
    run ~/Desktop/mytestdaemon.sh arg1 "arg 2";
    cwd ~;
    export MYTESTDAEMON_DEBUG=true;

    ## The user to run start the daemon as. If omitted, the user will
    ## not be changed.
    #user www-data;

    ## The group to run start the daemon as. If omitted, the user will
    ## not be changed.
    #group www-data;

    ## Path to a file to input to stdin.
    #stdin /dev/null;

    ## Path to the file that will capture the daemon's stdout.
    #stdout $root/$name.out;

    ## Path to the file that will capture the daemon's stderr.
    #stderr $stdout;

    ## Path to the file that will be used to store the PID.
    ## Do not change this value until the daemon is stopped again.
    #pidfile $root/$name.pid;

    ## Zero, one or more names of daemons that need to be started
    ## before this daemon can be started.
    #requires daemon1 daemon2;
}

Command-line Interface

nocrux [daemon(s)] command

The following commands expect no daemon(s) on the command-line.

  • version – Print the version of nocrux and exit

The following commands expect one or more daemons be specified on the command-line.

  • start – Start the daemon(s)
  • stop – Stop the daemon(s)
  • restart – Restart the daemon(s)
  • status – Show the status of the daemon(s)

The following commands expect exactly one daemon be specified on the command-line.

  • tail– Alias for tail:out
  • tail:out – Shows the tail of the daemons’ stdout
  • tail:err – Shows the tail of the daemons’ stderr
  • pid – Print the PID of the daemon (0 if the daemon is not running)

Daemon termination

nocrux can only send SIGTERM (and alternatively SIGKILL if the process doesn’t respond to the previous signal) to the main process that was also started with nocrux. If that process spawns any subprocess, it must take care of forwarding the signals to the child processes.

The thread Forward SIGTERM to child in Bash contains some information on doing that for Bash scripts. For very simple scripts that just set up an environment, I recommend the exec approach.

Changelog

v2.0.2

  • fix nocrux version command
  • add nocrux edit command
  • order of daemons when referencing them with all is now sorted alphabetically

v2.0.1

  • removed fn:out, fn:err and fn:pid commands (actually already removed in 2.0.0)
  • the default root config value will now be /var/run/nocrux if the configuration file is loaded from /etc/nocrux/conf
  • more sophisticated config file parsing with nr.parse.strex module
  • update error message hinting to check output of nocrux <daemon> tail if daemon could not be started

v2.0.0

  • cli is now nocrux <daemon> <command> (switched)
  • to specify multiple daemons, the <daemon> argument can be a list of comma separated daemon names
  • configuration file is no longer a Python script
  • configuration file must now be located at ~/.nocrux/conf or /etc/nocrux/conf
  • nocrux can now be installed via Node.py
  • add support for defining per-process environment variables

v1.1.3

  • update README.md (corrected example and command-line interface)
  • remove unusued -e, --stderr argument
  • fix setup.py (use py_modules instead of the invalid modules parameter)
  • enable running nocrux.py directly without prior installation
  • add pid, tail, tail:out and tail:err subcommands

v1.1.2

  • add setup.py installation script, remove nocrux script
  • update README.md and renamed from README.markdown

v1.1.1

  • close #18: Automatically expand prog ~ before starting process
  • fix #17: PID file not deleted after daemon stopped
  • close #16: Tail command is counter intuitive
  • update output of command-line program
  • process exit code is now printed to daemon standard error output file
  • fixed stopping multiple daemons when one wasn’t running
  • implement #10: daemon dependencies

v1.1.0

  • Renamed to nocrux
  • Update README and command-line help description

v1.0.1

  • Add krugs tail <daemon> [-e/-stderr] command
  • Add special deaemon name all
  • Fix krugs restart command
Release History

Release History

2.0.2

This version

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

2.0.1

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

2.0.0

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

1.1.4

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

1.1.3

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

1.1.2

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

Download Files

Download Files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
nocrux-2.0.2.tar.gz (10.2 kB) Copy SHA256 Checksum SHA256 Source May 14, 2017

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting