Created
June 7, 2010 18:57
-
-
Save sstrudeau/429030 to your computer and use it in GitHub Desktop.
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
#! /bin/sh | |
### BEGIN INIT INFO | |
# Provides: sphinx | |
# Required-Start: $all | |
# Required-Stop: $all | |
# Default-Start: 2 3 4 5 | |
# Default-Stop: 0 1 6 | |
# Short-Description: starts the sphinx search daemon for rails apps | |
# Description: starts sphinx by interfacing directly with ThinkingSphinx | |
### END INIT INFO | |
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin | |
NAME=sphinx | |
DESC=sphinx | |
# Rails app path & RAILS_ENV value | |
APP_PATH=/vagrant | |
APP_ENVIRONMENT=development | |
set -e | |
case "$1" in | |
start) | |
echo -n "Starting $DESC: " | |
cd $APP_PATH && RAILS_ENV=$APP_ENVIRONMENT rake ts:start | |
echo "$NAME." | |
;; | |
stop) | |
echo -n "Stopping $DESC: " | |
cd $APP_PATH && RAILS_ENV=$APP_ENVIRONMENT rake ts:stop | |
echo "$NAME." | |
;; | |
restart) | |
echo -n "Restarting $DESC: " | |
cd $APP_PATH && RAILS_ENV=$APP_ENVIRONMENT rake ts:restart | |
echo "$NAME." | |
;; | |
index) | |
echo -n "Building $DESC configuration and indices: " | |
cd $APP_PATH && RAILS_ENV=$APP_ENVIRONMENT rake ts:in | |
echo "$NAME." | |
;; | |
*) | |
N=/etc/init.d/$NAME | |
echo "Usage: $N {start|stop|restart|index}" >&2 | |
exit 1 | |
;; | |
esac | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment