每个用户的无痛守护进程管理器
nocrux的Python项目详细描述
概要
usage: nocrux [-h] [-e] [-l] [-f] [--sudo] [--as AS_] [--stderr] [--version] [daemon] [command] Nocrux is a daemon process manager that is easy to configure and can operate on the user- or root-level. The nocrux configuration syntax is similar to Nginx. All users configuration file is in ~/.nocrux/conf, except for the root user, which is in /etc/nocrux/conf. This will start your $EDITOR to open the configuration file: $ nocrux -e The main namespace has the options and default values below: root ~/.nocrux/run; kill_timeout 10; You can also include other files like this (relative paths are considered relative to the configuration file): include ~/more-nocrux-config.txt; To configure a new daemon, you start a `daemon` section, specify the name and then the daemon's options in the news scope. daemon jupyter { cwd ~; run jupyter notebook; } You can now start the daemon with: $ nocrux jupyter start [nocrux]: (jupyter) starting "jupyter notebook" [nocrux]: (jupyter) started (pid: 10117) The following commands are available for all daemons: - start - stop - restart - status - pid - cat - tail You can specify additional commands like this: daemon jupyter { cwd ~; run jupyter notebook; command uptime echo $(($(date +%s) - $(date +%s -r $DAEMON_PIDFILE))) seconds; } Now to run this command: $ nocrux jupyter uptime; 3424 seconds; Here's a daemon configuration with all available options and the respective default or example values: daemon test { # Example values: export PATH=/usr/sbin:$PATH; export DEBUG=1; run ~/Desktop/mytestdaemon.sh arg1 "arg 2"; cwd ~; command uptime echo $(($(date +%s) - $(date +%s -r $DAEMON_PIDFILE))) seconds; requires daemon1 daemon2; # Options with their respective defaults: user me; group me; stdin /dev/null; stdout $root/$name.out; stderr $stdout; pidfile $root/$name.pid; signal term TERM; signal kill KILL; } positional arguments: daemon The name of the daemon. command A command to execute on the specified daemon. optional arguments: -h, --help show this help message and exit -e, --edit Edit the nocrux configuration file. -l, --list List up all daemons and their status. -f, --follow Pass -f to the tail command. --sudo Re-invoke the same command with sudo. --as AS_ Run the command as the specified user. Overrides --sudo. --stderr Choose stderr instead of stdout for the cat/tail command. --version Print the nocrux version and exit.