本文介绍了在cron作业中顺序运行两个命令?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在cron工作中有两个命令,像这样:
I have two commands in a cron job like this:
mysql -xxxxxx -pyyyyyyyyyyv -hlocalhost -e "call MyFunction1";wget -N http://mywebsite.net/path/AfterMyFunction1.php
如何让第一个命令运行,当它完成后,执行第二个命令?
How can I make the first command run and when it completes, execute the second command?
此外,AfterMyFunction1.php有javascript http请求,当我使用wget时不执行。如果我在我的webbrowser中打开AfterMyFunction1.php,它会工作。
Also the AfterMyFunction1.php have javascript http requests that are not executed when I use wget. It works if I opened AfterMyFunction1.php in my webbrowser.
推荐答案
如果第一个命令需要首先完成,请使用,就像在shell中一样。如果第一个失败,第二个将不会运行。
If the first command is required to be completed first, you should separate them with the && operator as you would in the shell. If the first fails, the second will not run.
这篇关于在cron作业中顺序运行两个命令?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!