#!/bin/sh -e if [ -f "$__object/parameter/name" ] then name="$( cat "$__object/parameter/name" )" else name="$__object_id" fi if [ -f "$__object/parameter/password" ] then password="$( cat "$__object/parameter/password" )" else password='' fi host="$( cat "$__object/parameter/host" )" check_user="$( mysql -B -N -e "select user from mysql.user where user = '$name' and host = '$host'" )" if [ -n "$check_user" ] then if [ -n "$password" ] then check_password="$( mysql -B -N -e "select user from mysql.user where user = '$name' and host = '$host' and password = password( '$password' )" )" fi if [ -n "$password" ] && [ -z "$check_password" ] then echo 'change-password' else echo 'present' fi else echo 'absent' fi