Last active
May 20, 2016 20:32
-
-
Save jnesbitt/f2345132cf95ce37da7486f7c181a26f to your computer and use it in GitHub Desktop.
Quickly turn providers on and off. Usage: provider.sh [ westjet | air_canada | gws | all ] [ on | off ]
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
if [ "$#" -ne 2 ]; then | |
echo "Usage: `basename $0` [provider|all] [on|off]" | |
exit 1 | |
fi | |
providers=("westjet" "air_canada" "gws") | |
provider=$1 | |
enable="true" | |
operation="on" | |
if [ $2 = 'off' ]; then | |
enable="false" | |
operation=$2 | |
fi | |
success=false | |
for i in ${providers[*]}; do | |
if [[ $i = $provider || $provider = 'all' ]]; then | |
mysql -uroot tst -e "update TST_Parameters set Data_Value = \"$enable\" where Parameter_Name = \"#enable_$i\"" | |
success=true | |
fi | |
done | |
if [ success = false ]; then | |
echo "Provider not found" | |
exit 1 | |
else | |
echo "Turned $provider $operation" | |
fi | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
To make it extra simple add the following to your bash profile.
Providers
alias wjon='provider.sh westjet on'
alias wjoff='provider.sh westjet off'
alias acon='provider.sh air_canada on'
alias acoff='provider.sh air_canada off'
alias gwson='provider.sh gws on'
alias gwsoff='provider.sh gws off'
alias allon='provider.sh all on'
alias alloff='provider.sh all off'