~tim-alwaysreformed/reformedchurcheslocator/rcl-backbone-test_for_directory_type

« back to all changes in this revision

Viewing changes to get_port.sh

  • Committer: Tim Black
  • Date: 2012-07-23 21:59:03 UTC
  • Revision ID: tim@alwaysreformed.com-20120723215903-rgjhrh9ojf132cnp
Maybe fixed Node changes listener loop

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
#!/bin/sh
2
2
 
3
 
# Get the randomly-generated port for desktopcouch
4
 
PORT=$(dbus-send --session --dest=org.desktopcouch.CouchDB    --print-reply --type=method_call /    org.desktopcouch.CouchDB.getPort | sed -e 's/^.* //' | tail -1)
5
 
echo $PORT
 
3
# Get the currently-known port
 
4
PORT=$(cat port.txt)
 
5
# Get the admin username and password for couchdb
 
6
AUTH=$(cat auth.txt)
 
7
DB_RESPONSE=$(curl http://$AUTH@localhost:$PORT/)
 
8
# Test to see if the currently-known port works
 
9
if [ `expr match "$DB_RESPONSE" "{\"couchdb\":\"Welcome\",\"version\".*"` -gt 0 ] ;
 
10
then
 
11
    echo "We have the right port!  So we aren't modifying the filesystem."
 
12
else
 
13
    echo "We don't have the right port yet.  So we'll get it and write it to port.txt."
 
14
    # Get the randomly-generated port for desktopcouch
 
15
    PORT=$(dbus-send --session --dest=org.desktopcouch.CouchDB    --print-reply --type=method_call /    org.desktopcouch.CouchDB.getPort | sed -e 's/^.* //' | tail -1)
 
16
    echo $PORT > port.txt
 
17
fi