Author: glen Date: Wed Dec 13 14:07:53 2006 GMT Module: SOURCES Tag: HEAD ---- Log message: - introduce some completion logic so you could call # service mysql restart work if you have in `/etc/mysql/clusters.conf': work.conf=/var/lib/mysql/work
---- Files affected: SOURCES: mysql.init (1.105 -> 1.106) ---- Diffs: ================================================================ Index: SOURCES/mysql.init diff -u SOURCES/mysql.init:1.105 SOURCES/mysql.init:1.106 --- SOURCES/mysql.init:1.105 Tue Oct 24 09:50:39 2006 +++ SOURCES/mysql.init Wed Dec 13 15:07:48 2006 @@ -59,7 +59,22 @@ if [ $# -gt 1 ]; then shift # perform action for specified clusters only - DB_CLUSTERS="$@" + for a in "$@"; do + # try auto resolving from /etc/mysql/clusters.conf + if [[ "$a" != /* ]]; then + m=$(awk -va="$a" -F= 'substr($0, 1, length(a)) == a {print $1}' /etc/mysql/clusters.conf) + if [ -z "$m" ]; then + echo >&2 "Cluster name '$a' did not match anything!" + exit 1 + fi + if [ $(echo "$m" | wc -l) -gt 1 ]; then + echo >&2 "Cluster name '$a' ambiguous:" $m + exit 1 + fi + a=$(awk -va="$a" -F= 'substr($0, 1, length(a)) == a {print $2}' /etc/mysql/clusters.conf) + fi + DB_CLUSTERS="$DB_CLUSTERS $a" + done else DB_CLUSTERS="$MYSQL_DB_CLUSTERS" fi ================================================================ ---- CVS-web: http://cvs.pld-linux.org/SOURCES/mysql.init?r1=1.105&r2=1.106&f=u _______________________________________________ pld-cvs-commit mailing list pld-cvs-commit@lists.pld-linux.org http://lists.pld-linux.org/mailman/listinfo/pld-cvs-commit