linux cron 作业是否应该用“&”指定以指示在后台运行?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/10503433/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Should linux cron jobs be specified with an "&" to indicate to run in background?
提问by user265330
In a crontab file, should commands be specified with a trailing "&", or will the command run in the background anyway?
在 crontab 文件中,是否应该使用尾随的“&”指定命令,还是该命令会在后台运行?
I have:
我有:
*/20 * * * * /home/me/monitor/check.sh /home/me/monitor/check.properties >> /home/me/monitor/check.log 2>&1 &
I've seen contradictory answers to this question in various places. Some say no need to put an "&", others that without the ampersand cron waits for output from the command, even though all output is redirected.
我在很多地方看到过这个问题的矛盾答案。有些人说不需要放置“&”,其他人说没有 & 号 cron 会等待命令的输出,即使所有输出都被重定向。