a painless per-user daemon manager
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
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
File details
Details for the file nocrux-2.0.2.tar.gz
.
File metadata
- Download URL: nocrux-2.0.2.tar.gz
- Upload date:
- Size: 10.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 76277071897a7c5860007ee5b6bd6dc8633e547404c9277e487c52614f9963f6 |
|
MD5 | e7fd9da671f282f0f3db93e2752d4eb0 |
|
BLAKE2b-256 | 2cf7c1ac7e133d18512e0f03d4b9d5d1be343dcbcc7845ff74308cc14982e3d2 |