我有多个 bash 脚本来在多个目录中反弹 Jboss 实例。这些脚本接受参数
开始|停止 |重新加载 |状态 |重启。
/opt/xyz/x/X_FE.sh
/opt/xyz/x/X_BE.sh
/opt/xyz/y/Y_FE.sh
/opt/xyz/y/Y_BE.sh
/opt/xyz/z/Z_BE.sh
我希望有一个 bash 脚本接受相同的参数并执行上面提到的所有 5 个脚本。
/opt/singlescript.sh start ---- must execute all the 5 scripts with start argument.
如有任何帮助,我们将不胜感激。
最佳答案
它看起来像这样。有多种方法可以做到这一点,这只是一种方法
#!/bin/bash
echo "invoking x/X_FE with $1"
sh /opt/xyz/x/X_FE.sh $1
echo "invoking x/X_BE with $1"
sh /opt/xyz/x/X_BE.sh $1
echo "invoking y/Y_FE with $1"
sh /opt/xyz/y/Y_FE.sh $1
echo "invoking x/Y_BE with $1"
sh /opt/xyz/y/Y_BE.sh $1
echo "invoking z/Z_FE with $1"
sh /opt/xyz/z/Z_BE.sh $1
关于linux - 使用一个 bash 脚本在 diff 目录中执行多个 bash 脚本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40221417/