Skip to content

Instantly share code, notes, and snippets.

@alphabraga
Created January 16, 2020 16:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alphabraga/5ec0a3474073fce2018db5d44c6e1754 to your computer and use it in GitHub Desktop.
Save alphabraga/5ec0a3474073fce2018db5d44c6e1754 to your computer and use it in GitHub Desktop.
realiza o flush do poll do jboss
#!/bin/bash
tipo=$1
if [ -z $tipo ]
then
echo "Parâmetro obrigatório info ou o tipo de operacao [all, idle]"
exit 1;
fi
jbosscli='/home/jboss/appServer_EMAP/bin/jboss-cli.sh'
jbossserver='tos.emap.ma.gov.br:1000'
info(){
echo "==========informações sobre as conexões=========="
$jbosscli --connect --controller="'$jbossserver'" --command="/subsystem=datasources/data-source=tosp/statistics=pool:read-resource(include-runtime=true)"
echo "==========informações sobre as conexões=========="
}
flushall(){
echo "Realizando o flush all (removendo TODAS as conexões)"
$jbosscli --connect --controller="'$jbossserver'" --command="/subsystem=datasources/data-source=tosp/:flush-all-connection-in-pool"
}
flushidle(){
echo "Realizando o flush idle (removendo as conexões IDLE)"
$jbosscli --connect --controller="'$jbossserver'" --command="/subsystem=datasources/data-source=tosp/:flush-idle-connection-in-pool"
}
if [ "$tipo" = 'all' ]
then
flushall
fi
if [ "$tipo" = 'idle' ]
then
flushidle
fi
if [ "$tipo" = "info" ]
then
info
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment