从 sh 文件不朽启动并观察进程

从 sh 文件不朽启动并观察进程

我已经安装不朽我想要启动一个包含在.sh文件中的脚本。

我尝试查看文档但总是得到一个missing command error

这是我尝试过的:

immortal -l /tmp/play-log.log -logger play.sh 

目的是启动一个play.sh脚本。

这是用法immortal -h

Usage: immortal [-v] [-ctl dir] [-d dir] [-e dir] [-f pidfile] [-l logfile] [-logger logger] [-p child_pidfile] [-P supervisor_pidfile] [-u user] command

command
    The command with arguments if any, to supervise

-c run.yml
     run.yml configuration file
-ctl /var/run/immortal/<service>
    Create supervise directory /var/run/immortal/<service>
-d dir
    Change to dir before starting the command
-e dir
    Set environment variables specified by files in the dir
-f pidfile
    Follow PID in pidfile
-l logfile
    Write stdout/stderr to logfile
-logger command
    A command to pipe stdout/stderr to stdin
-n  No daemon mode, stay in the foreground
-P pidfile
    Path to write the supervisor pidfile
-p pidfile
    Path to write the child pidfile
-r number
    number of retries before program exit
-u user
    Execute command on behalf user
-v  Print version
-w seconds
    seconds to wait before starting

答案1

好的,作为一个 sh 文件,解决方案是:

immortal -l ./play-log.txt /bin/sh -c "./play.sh"

或无日志

immortal /bin/sh -c "./play.sh"

相关内容