Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save MikeMichel/048706f088c895f40fc6f29231a5cf2a to your computer and use it in GitHub Desktop.
Save MikeMichel/048706f088c895f40fc6f29231a5cf2a to your computer and use it in GitHub Desktop.
#!/bin/bash
#enable job control in script
set -m
# when /etc/couchdb (contains i.g. admin account) was not allready moved to persistant storage, do it and symlink the org. directory
if [ ! -d /var/lib/couchdb/etc/couchdb ]; then
mkdir /var/lib/couchdb/etc
mv /etc/couchdb /var/lib/couchdb/etc/
ln -s /var/lib/couchdb/etc/couchdb/ /etc/couchdb
else
rm -rf /etc/couchdb
ln -s /var/lib/couchdb/etc/couchdb/local.ini /etc/couchdb/local.ini
ln -s /var/lib/couchdb/etc/couchdb/default.ini /etc/couchdb/default.ini
fi
#run CouchDB in background
couchdb &
#set password for admin account
if [ ! `/bin/grep ^admin /etc/couchdb/local.ini` ]; then
/create_couchdb_admin_user.sh
fi
#bring couchdb to foreground
fg
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment