Jithin Jithin - 3 months ago 31
Bash Question

To execute multiple bash scripts in diff directories using one single bash script

I have multiple bash scripts to bounce Jboss instances in multiple directories. These scripts accepts arguments

start | stop | reload | status | restart.


I wish to have a single bash script which accepts the same arguments and execute all the 5 scripts mentioned above.

/opt/singlescript.sh start ---- must execute all the 5 scripts with start argument.

Any help would be much appreciated.


It would look something like this. There are multiple ways to do this and this is just one way

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