Skip to content

Instantly share code, notes, and snippets.

@darshitvvora
Created May 5, 2020 07:12
Show Gist options
  • Select an option

  • Save darshitvvora/ece9884e75c868f395a93e45c67acb98 to your computer and use it in GitHub Desktop.

Select an option

Save darshitvvora/ece9884e75c868f395a93e45c67acb98 to your computer and use it in GitHub Desktop.
Launch all project apps on your local machine using shell script. This is useful when some apps are dependent on other in separate projects
projDir='/home/USERNAME/projects/'
declare -A MYMAPS=(
["ui-1"]="grunt serve"
["ui-2"]="grunt serve"
["ui-3"]="gulp serve"
["ui-4"]="gulp serve"
["ui-5"]="gulp serve"
["accounts"]="gulp serve"
["xtension"]="npm run dev"
["emailq"]="npm run dev"
["api"]="grunt serve"
["lambda1"]="npm run start"
["billing"]="npm run startApi;npm run startUI;npm run startLambda"
["verify"]="npm run start;npm run startLambda"
);
launchCmd=''
for app in "$@"; do
STR=${MYMAPS[$app]}
IFS=';'
read -ra commandArr <<< "$STR"
for command in ${commandArr[*]}; do
cmd='cd '$projDir$app' && '$command
launchCmd+=(--tab -t "$app=>$command" -e "bash -c '$cmd';bash")
# launchCmd+=(--tab -t "$app=>$command" --working-directory="$projDir$app" -e "bash -c '$command';bash")
done
done
gnome-terminal "${launchCmd[@]}";
# mate-terminal "${launchCmd[@]}"
exit 0;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment