【问题标题】:How to combine 3 commands into a single process for runit to monitor?如何将 3 个命令组合成一个进程供 runit 监控?
【发布时间】:2015-01-19 20:48:36
【问题描述】:

我编写了一个脚本,它使用 wget 命令从两个来源获取一组参数,将它们存储到一个变量中,然后根据检索到的参数执行视频转码过程。安装了 Runit 来监控进程。

问题是当我尝试停止该进程时,runit 不知道只需要停止最后一个转码进程,因此它无法停止它。

如何将 bash 脚本中的所有命令组合成单个进程/应用程序?

命令如下:

wget address/id.html
res=$(cat res_id | grep id.html)
wget address/length.html
time=$(cat length_id | grep length.html)
/root/bin -i video1.mp4 -s $res.....................

【问题讨论】:

    标签: bash monitor runit


    【解决方案1】:

    尝试将它们包装在外壳中:

    sh -c '
        wget address/id.html
        res=$(grep id.html res_id)
        wget address/length.html
        time=$(grep length.html length_id)
        /root/bin -i video1.mp4 -s $res.....................
    '
    

    【讨论】:

    • 不,那没用。在我停用 runit 作业后,该进程仍在运行。
    猜你喜欢
    • 2015-04-20
    • 1970-01-01
    • 1970-01-01
    • 2017-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-02-11
    • 1970-01-01
    相关资源
    最近更新 更多