如何从另一个sh文件运行sh文件 [英] How to run sh file from another sh file
问题描述
我有一个用于监视我的应用程序的shell脚本文件,该脚本将通过设置cron作业每10分钟执行一次.
I have a shell script file for monitoring my application, this script will be executed every 10 min by setting cron job.
我想更多与监视有关的脚本文件应与主文件一起执行.所以我想将我的脚本包括到主文件中.如何从主sh文件运行那些sh文件
I would like to some more script files which are related to monitoring should be executed along with master file. So I would like to include my scripts to master file. How to run those sh file from master sh file
推荐答案
Take a look at this. If you want to run a script you can use:
./yourscript.sh
如果脚本有循环,请使用:
If your script has a loop, use:
./yourscript.sh&
如果要在启动脚本后获取控制台,并且不想看到其输出,请使用:
If you want to get the console after starting scripts and you don't want to see it's output use:
./yourscript.sh > /dev/null 2>&1 &
因此,在主文件中,您将拥有:
So, in the master file you'll have:
./yourscript1.sh > /dev/null 2>&1 &
./yourscript2.sh > /dev/null 2>&1 &
./yourscript3.sh > /dev/null 2>&1 &
他们将一起开始.
这篇关于如何从另一个sh文件运行sh文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!