Created
June 26, 2012 09:45
-
-
Save peterwongpp/2994721 to your computer and use it in GitHub Desktop.
shell function to start and stop services in a more readable way
This file contains 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
start() { | |
case "$1" in | |
mysql) | |
# cd /usr/local/Cellar/mysql/5.5.25 ; /usr/local/Cellar/mysql/5.5.25/bin/mysqld_safe & | |
/usr/local/bin/mysql.server start | |
;; | |
postgresql) | |
pg_ctl -D /usr/local/var/postgres -l /usr/local/var/postgres/server.log start | |
# to install postgres gem: env ARCHFLAGS="-arch x86_64" gem install pg | |
;; | |
mongodb) | |
mongod run --config /usr/local/etc/mongod.conf --rest | |
;; | |
redis) | |
# to connect in localhost: redis://localhost:6379 | |
redis-server /usr/local/etc/redis.conf | |
;; | |
elasticsearch) | |
elasticsearch -f -D es.config=/usr/local/Cellar/elasticsearch/0.19.6/config/elasticsearch.yml | |
# logs: open /usr/local/var/log/elasticsearch/elasticsearch_peter.log | |
# folder with cluster data: open /usr/local/var/elasticsearch/elasticsearch_peter/ | |
# see ElasticSearch running: open http://localhost:9200 | |
;; | |
apache) | |
sudo apachectl start | |
;; | |
esac | |
} | |
stop() { | |
case "$1" in | |
mysql) | |
/usr/local/bin/mysql.server stop | |
;; | |
postgresql) | |
pg_ctl -D /usr/local/var/postgres stop -s -m fast | |
;; | |
apache) | |
sudo apachectl stop | |
;; | |
esac | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment