Created
July 19, 2012 17:25
-
-
Save boxxxie/3145494 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
base_dir=$(dirname "$0") | |
echo basedir "$base_dir" | |
script=$(readlink -f "$0") | |
echo script "$script" | |
# Absolute path this script is in, thus /home/user/bin | |
script_path=$(dirname $script) | |
echo sript path" $script_path" | |
script_parent_path="$script_path"/.. | |
echo scriptparentpath "$script_parent_path" | |
execution_path=$(pwd) | |
execution_parent_path="$execution_path/.." | |
echo execution parent path "$execution_parent_path" | |
number_of_args="$#" | |
echo number of arguments given "$number_of_args" | |
if (( number_of_args > 1 )); then | |
echo "Usage: $0 [couchdb path]" | |
exit | |
fi | |
if [ -n "$1" ]; | |
then | |
couchdb_install_path="$1"; | |
else | |
couchdb_install_path="$execution_parent_path"/couchdb; | |
fi | |
echo | |
echo arg1 "$1" | |
echo couchdb install path "$couched_install_path" | |
echo | |
domain="localhost" | |
echo $domain | |
curl -s http://localhost:5984 | |
couchdb_running="$?" | |
echo couchdb status "$couchdb_running" | |
if ((couchdb_running != 0)) | |
then | |
echo "$couchdb_install_path"/build/env.sh | |
. "$couchdb_install_path"/build/env.sh | |
couchdb & | |
else | |
echo couchdb is already running | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment