Skip to content
This repository has been archived by the owner on Dec 19, 2023. It is now read-only.

如果 shell 中使用 exec 会导到日志不能被重定向 #59

Open
maxid opened this issue Apr 9, 2018 · 1 comment
Open

如果 shell 中使用 exec 会导到日志不能被重定向 #59

maxid opened this issue Apr 9, 2018 · 1 comment

Comments

@maxid
Copy link

maxid commented Apr 9, 2018

如程序启动脚本 start.sh 内容如下

#!/bin/sh
echo "test"
exec /bin/some/exe "$@"

gosuv调用的脚本 gosuv-lancher.sh 如下

#!/bin/sh
nohup ./start.sh xxx > server.log

这样本应该输出到 server.log 的日志就会因为start.sh 里的 exec 被 gosuv 拦截输出到 gosuv 自己的程序日志中

image

@codeskyblue
Copy link
Owner

是的,gosuv当初的设计就是这样的。如果像重定向到别的地方,可以不用exec,改成

/bin/some/exe &>somelog.txt

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants