[Groonga-commit] groonga/gcs [master] Context aware prerequsites representation

Back to archive index

null+****@clear***** null+****@clear*****
2012年 7月 5日 (木) 01:37:15 JST


Yoji SHIDARA	2012-07-05 01:37:15 +0900 (Thu, 05 Jul 2012)

  New Revision: 3f3e72536adb4f47be0c03857b91f02842531f22
  https://github.com/groonga/gcs/commit/3f3e72536adb4f47be0c03857b91f02842531f22

  Log:
    Context aware prerequsites representation

  Modified files:
    bin/gcs-import-examples

  Modified: bin/gcs-import-examples (+46 -7)
===================================================================
--- bin/gcs-import-examples    2012-07-05 00:20:21 +0900 (5ed7c6f)
+++ bin/gcs-import-examples    2012-07-05 01:37:15 +0900 (df23b9d)
@@ -1,29 +1,68 @@
 #!/bin/sh
 
+GREEN=$'\e[0;32;1m'
+RED=$'\e[0;31;1m'
+YELLOW=$'\e[1;33;1m'
+RESET=$'\e[m'
+
 cat <<EOT
 Groonga CloudSearch example data importer
 -----------------------------------------
 
 This script setup an example domain and import data into the domain.
 
-Prerequsites:
+EOT
+
+echo "Checking prerequsites..."
+echo
+
+printf "* Host entries for endpoints..."
+
+ping -c 1 doc-example-00000000000000000000000000.localhost 1> /dev/null 2>&1
+doc_ping_status=$?
+ping -c 1 search-example-00000000000000000000000000.localhost 1> /dev/null 2>&1
+search_ping_status=$?
 
-1) You need to direct 'doc-example-00000000000000000000000000.localhost' and 'search-example-00000000000000000000000000.localhost' to localhost before trying this example. The following command will make these entries on /etc/hosts:
+if [ $doc_ping_status -eq 0 -a $search_ping_status -eq 0 ]
+then
+  echo " "$GREEN"OK"$RESET
+else
+  echo " "$RED"not configured"$RESET
 
-$ sudo gcs-register-hosts example
+  cat << EOT
+$YELLOW
+You need to direct 'doc-example-00000000000000000000000000.localhost' and 'search-example-00000000000000000000000000.localhost' to localhost before trying this example. The following command will make these entries on /etc/hosts:
 
-2) You need to run gcs on port 7575. Just run gcs command without any options.
+  $ sudo gcs-register-hosts example
+$RESET
+EOT
+fi
+
+printf "* gcs running..."
+curl --silent "http://localhost:7575" > /dev/null
+if [ $? -eq 0 ]
+then
+  echo " "$GREEN"OK"$RESET
+else
+  echo " "$RED"not running"$RESET
+cat <<EOT
+$YELLOW
+You need to run gcs on port 7575. Just run gcs command without any options on another terminal.
+
+  $ gcs
+$RESET
+EOT
+fi
 
-$ gcs
+cat <<EOT
 
 NOTICE:
 
 If you have data in the domain whose name is 'example', it will be updated.
 
 
+Hit enter to continue. Ctrl-C to break.
 EOT
-
-echo "Hit enter to continue. Ctrl-C to break."
 read
 
 
-------------- next part --------------
HTML$B$NE:IU%U%!%$%k$rJ]4I$7$^$7$?(B...
下载 



Groonga-commit メーリングリストの案内
Back to archive index