]> git.pld-linux.org Git - packages/mysql.git/commitdiff
- introduce some completion logic so you could call
authorElan Ruusamäe <glen@pld-linux.org>
Wed, 13 Dec 2006 14:07:48 +0000 (14:07 +0000)
committercvs2git <feedback@pld-linux.org>
Sun, 24 Jun 2012 12:13:13 +0000 (12:13 +0000)
  # service mysql restart work
  if you have in `/etc/mysql/clusters.conf':
  work.conf=/var/lib/mysql/work

Changed files:
    mysql.init -> 1.106

mysql.init

index 54d3dfa9c387176a2f16c1bfa74fe5b36e9daa0f..9c1591b1b2de978badf218e55679dbfad2288c3f 100644 (file)
@@ -59,7 +59,22 @@ action="$1"
 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
This page took 0.156003 seconds and 4 git commands to generate.