This package allows to create and manage Single Unique Processes
git clone https://github.com/darkAlert/suproc.git
cd suproc
bash install.sh
sudo pip3 install git+https://github.com/darkAlert/suproc.git#egg=suproc --break-system-packages
suproc-init
Before using the package, you have to run suproc-init to initialize it and create directories for the PID and LOG files.
Update pip if the package is installed with the name UNKNOWN:
python3 -m pip install --upgrade pip
If the package is not found in the terminal after installation, try running:
source ~/.profile
suproc-init --deinit
pip3 uninstall suproc -y --break-system-packages
Create and run a single instance process:
nameProcess name to run-c CMDS, --cmds CMDSList of command strings-f, --forceKill the process if it is running-d, --daemonCreate a daemon process-pd PDIR, --pdir PDIRPIDLockFile directory (/var/run/ava/by default)-ld LDIR, --ldir LDIRLogs directory (/var/log/ava/by default)-p PARENT, --parent PARENTThe parent process ID-o STDOUT, --stdout STDOUTWhere to direct the process's stdout:pipe,devnull-e STDERR, --stderr STDERRWhere to direct the process's stderr:pipe,stdout,devnull
Stop a single instance process by its name:
nameProcess name to stop-nk, --no-killer-procCreate a killer process and try to stop the target process in it-f, --forceIf set, the current process may also be stopped!-k, --killSend SIGTERM instead of SIGINT--purgeRemove the pid and log files of the stopped process-pd PDIR, --pdir PDIRPIDLockFile directory-ld LDIR, --ldir LDIRLogs directory
Print logs of a single instance process by its name (NOTE: the log is created only for processes running in daemon mode):
nameProcess name to print its log-f, --followFollow new lines and print them as they appear-n LAST_N, --last-n LAST_NThe number of lines to print from the end of the file-s SESSION, --session SESSIONPrint the full log of the specified process session-rm, --removeRemove a log file by process name-c, --clearClear the log file according to the session number-ld LDIR, --ldir LDIRLogs directory
Print a list of processes:
-a, --allPrint processes with any state-pd PDIR, --pdir PDIRPIDLockFile directory
Print a list of logs of processes:
-c, --clearDelete all logs without processes-p, --pathsPrint log file paths instead of log names-pd PDIR, --pdir PDIRPIDLockFile directory-ld LDIR, --ldir LDIRLogs directory
Managing the PID, LOGS, and CONFIG directories of 'suproc' package:
-pd PDIR, --pdir PDIRPIDLockFile directory-ld LDIR, --ldir LDIRLogs directory-cf CONF, --conf CONFConfig file path-y YES, --yes YESAnswer 'yes' to each question of the initializer-de DEINIT, --deinit DEINITDeinitialize the package and remove all its files
Create and start a process named test that will execute the bash command: ls / -l:
suproc run test -c='ls / -l'
Same thing, but the process will be run in daemon mode:
suproc run test -d -c='ls / -l'
Show the log of the running process:
suproc log test
Kill process:
suproc kill test
TO DO...