Skip to main content

painless per-user daemon manager

Project description

nocrux is a painless per-user daemon manager that is easily configured with a Python 3 script in the users home directory. It supports many of the common settings to start daemon processes such as redirecting stdout/stderr, pidfiles (required), additional arguments, process current working directory and more.

EXAMPLE CONFIGURATION

The configuration file for nocrux must be in ~/nocrux_config.py.

root_dir = expanduser('~/.nocrux')  # default
kill_timeout = 10  # default
register_daemon(
  name = 'test',
  prog = expanduser('~/Desktop/my-daemon.sh'),
  args = [],      # default
  cwd  = '~',     # default, automatically expanded after setting user ID
  user = None,    # name of the user, defaults to current user
  group = None,   # name of the group, defaults to current user group
  stdin = None,   # stdin file, defaults to /dev/null
  stdout = None,  # stdout file, defaults to ${root_dir}/${name}.out
  stderr = None,  # stderr file, defaults to stdout
  pidfile = None, # pid file, defaults to ${root_dir}/${name}.pid
  requires = [],  # default, list of daemon names that need to run before this
)

COMMANDLINE INTERFACE

usage: nocrux [-h]
              {version,start,stop,restart,status,fn:out,fn:err,fn:pid}
              [daemon [daemon ...]]

painless per-user daemon manager. https://github.com/NiklasRosenstein/nocrux

positional arguments:
  {version,start,stop,restart,status,fn:out,fn:err,fn:pid}
  daemon                name of one or more daemons to interact with. Use
                        'all' to refer to all registered daemons

optional arguments:
  -h, --help            show this help message and exit

EXAMPLE USAGE

niklas@sunbird ~$ nocrux start test
[nocrux]: (test) starting "/home/niklas/Desktop/daemon.sh"
[nocrux]: (test) started. (pid: 3203)
niklas@sunbird ~$ nocrux status all
[nocrux]: (test) started
niklas@sunbird ~$ tail $(nocrux fn:out test)
daemon.sh started
[nocrux]: (test) terminated. exit code: -15
daemon.sh started
[nocrux]: (test) terminated. exit code: -15
daemon.sh started
[nocrux]: (test) terminated. exit code: -15
daemon.sh started
daemon.sh ended
[nocrux]: (test) terminated. exit code: 0
daemon.sh started
^Cniklas@sunbird ~$ nocrux stop all
[nocrux]: (test) stopping... done

INSTALLATION

pip install nocrux

REQUIREMENTS

  • Python 3

  • Unix-like operating system (tested on Ubuntu 15.05, Mac OS X El Capitan)

  • Pandoc when installing from the Git repository (not required for Pip installation)

CHANGELOG

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)

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

Project details


Download files

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

Source Distribution

nocrux-1.1.3.zip (12.0 kB view details)

Uploaded Source

File details

Details for the file nocrux-1.1.3.zip.

File metadata

  • Download URL: nocrux-1.1.3.zip
  • Upload date:
  • Size: 12.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for nocrux-1.1.3.zip
Algorithm Hash digest
SHA256 32c516cd8b899716aab17027e86bf68b3763b8f62d05f4afe0c68453afa5a421
MD5 9d9080b9174da81a452f075376b4781b
BLAKE2b-256 b1eb6658e1e3a9188eeecfa6e482523943b40f530937ebe2b6ec7e15e0903e31

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page