将 /usr/bin/sh -> dash
改成
/usr/bin/sh -> /usr/bin/bash
即可解决.
ln -sf /usr/bin/bash /usr/bin/sh
cmd=" nohup python3 xxxx.py > /xx/xxx.log 2>&1 &"
#在python里执行上边的命令
ret = subprocess.Popen(cmd,shell=True,stdout=subprocess.PIPE,stderr=subprocess.PIPE)
log.logger.info(f"ret: {ret.pid}")
ps -ef | grep pid
查看结果是 僵尸进程
t$ ps -ef | grep 30191
zeekr 30191 29743 0 19:46 pts/15 00:00:00 [sh] <defunct>
zeekr 30289 29368 0 19:49 pts/17 00:00:00 grep --color=auto 30191