zhen: process and cron manager

Updated at: 2023-12-05

Context

Old friends know that joker is an ultra-minimalist process management tool. It is not CS architecture, no dependencies, and no need to run a background process in advance. Meanwhile, jinbe can easily manage startup commands.

Recently, I have written some jb scripts that require scheduled tasks to run. Coupled with feedback on joker and jinbe from the group, I am planning to replace jinbe. Thus, zhen was born, a name inspired by Xian Zhen. It possesses the functions of both joker and jinbe, along with optimizations for some special scenarios. However, currently it still partially relies on the existence of the joker command. The system requires an IPv6 stack.

To: TA and Brook Plus and Shiliew users

Install

if you have no joker

nami install joker

install zhen

nami install zhen

Start zhen background at boot

sudo or root required

zhen init

Start zhen background now

sudo or root required

joker zhen background

Usage

No sudo or root required

add a command, reboot and now

zhen brook server -l :9999 -p hello

add a cron command

zhen '0 0 * * *' jb /path/to/script.js

For the same scheduled task, if it is about to run and the previous run has not yet finished, then cancel this run and wait for the next cycle.

Env

As you know, usually when the system just boots up, some environment variables do not exist, such as HOME, and the PATH variable is also relatively concise, and your command may depend on these environment variables, then you can use zhen to set.

For example, set HOME

zhen env HOME /root

For example, set PATH to current PATH

zhen env PATH $PATH

Show all env

zhen env

Network

As you know, usually when the system just boots up, the network may not be ready yet, don't worry, zhen will run all your commands after the network is ready.

More

show all commands

zhen all

show running commands

zhen ps

stop command by SIGTERM

zhen st <id>

restart or start command

zhen rs <id>

remove command

zhen rm <id>

show log of command

zhen log <id>

Comments