![从 sh 文件不朽启动并观察进程](https://linux22.com/image/1157946/%E4%BB%8E%20sh%20%E6%96%87%E4%BB%B6%E4%B8%8D%E6%9C%BD%E5%90%AF%E5%8A%A8%E5%B9%B6%E8%A7%82%E5%AF%9F%E8%BF%9B%E7%A8%8B.png)
我已经安装不朽我想要启动一个包含在.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"