Task used to run a command line mysql client.
This task is able to communicate with MySQL Server instance.
It has two different working modes: running a batch command, or
running a script .sh (executed with bash).
The variables overwritten by default by the task are:
image: default image to run isopensips/mysql-client
Additional settings that can be passed to the task:
script: optional, a path to a.shscript that can be executed; if missing, themysql-clienttool is executedhost: optional, the IP of the MySQL Server to connect; if missing, socket/var/run/mysqld/mysqld.sockis usedport: optional, the port of the MySQL Server to connect; if missing,3306is useduser: optional, the user of the MySQL Server to connect; if missing,rootis usedpassword: optional, the password of the MySQL Server to connectdatabase: optional, the database of the MySQL Server to connectoptions: optional, additional options of the MySQL Client; options should be formatted
Check contacts from OpenSIPS location table
scenario.yml
- name: MySQL check Register
type: mysql-client
script: scripts/mysql-register.sh
host: 192.168.52.2scripts/mysql-register.sh
l=$(mysql opensips -Nse 'select count(*) from location')
if [ "$1" = "unregister" ]; then
[ "$l" == "0"] && exit 0
else
[ "$" == "1" ] && exit 0
fi
echo "ERROR: number of contacts is $l"
exit 1