z: 进程管理器

Updated at: 2024-07-20

背景

老朋友知道,joker 是一个极简的进程管理工具,小巧在他不是 CS 架构,无依赖,也无需事先运行一个后台进程,随用随时一条命令。而 jinbe 可以轻巧的管理开机启动命令。

根据群友对 joker 和 jinbe 的反馈,所以准备替换掉 jinbe。于是诞生了 z,名称取自 先轸,他同时拥有 joker 和 jinbe 的功能,以及对一些特殊场景做了优化。系统需有 IPv6 栈。

安装

nami install z

启动 z 守护进程

start z daemon and add z into system boot. [this step requires root privileges] and [z requires your system to support the IPv6 stack]

z start

环境变量

大家知道,通常系统刚启动的时候,有些环境变量是不存在的,比如HOME,而PATH变量也比较简洁,而你的命令可能依赖于这些环境变量,那么你可以使用z来设置。

比如设置 HOME

z e HOME /root

比如设置 PATH 为当前上下文的 PATH

z e PATH $PATH

使用

添加一个命令

z brook server -l :9999 -p hello

网络

如你所知,通常系统刚启动时,网络可能还没有准备好,不用担心,z 会在网络准备好后运行你的所有命令。

更多

z - process manager

    start                             start z daemon and add z into system boot [root and ipv6 stack required]

    <command> <arg1> <arg2> <...>     add and run command
    a                                 print all commands
    s <id>                            stop a command
    r <id>                            restart a command
    d <id>                            delete a command

    e <k> <v>                         add environment variable
    e                                 print all environment variables

    <id>                              print stdout and stderr of command
    z                                 print stdout and stderr of z

    stop                              stop z daemon