我有一堆shell脚本,我想对它们进行排序。我可以写一个主shell脚本。但我不太擅长shell脚本。 我听说drake是一个工作控制流程工具。我想看看它是否可以用于以集成方式创建/运行shell脚本
示例:
nohup run shell_script_1.ksh
Once this is successfully complete run next else exit with error code 1
nohup run shell_script_2.ksh &
nohup run shell_script_3.ksh
Once both the scripts run successfully, move to next else exit with error code 2
nohup ksh shell_script_4.ksh&
nohup ksh shell_script_5.ksh&
nohup ksh shell_script_6.ksh&
Once the above 3 scripts complete, move to next else exit with error code3
finally execute
nohup ksh shell_script_4.ksh
或者,如果我在YAML文件中安排运行这些脚本的规则,是否有可以使用的主shell脚本生成器?
由于 彩
答案 0 :(得分:3)
尝试这样的事情。将其保存为run_scripts.ksh,然后运行它。
#!/usr/bin/env ksh
trap '' HUP
trap 'echo EXITING DUE TO SIGNAL ; exit 15' INT TERM
${SHELL-ksh} shell_script_1.ksh || exit 1
${SHELL-ksh} shell_script_2.ksh &
${SHELL-ksh} shell_script_3.ksh || exit 2
wait || exit 2
${SHELL-ksh} shell_script_4.ksh &
${SHELL-ksh} shell_script_5.ksh &
${SHELL-ksh} shell_script_6.ksh &
for x in 4 5 6
do
wait || exit 3
done
${SHELL-ksh} shell_script_4.ksh #not 7?
exit $?