Skip to content

Instantly share code, notes, and snippets.

@sstrudeau
Created June 7, 2010 18:57
Show Gist options
  • Save sstrudeau/429030 to your computer and use it in GitHub Desktop.
Save sstrudeau/429030 to your computer and use it in GitHub Desktop.
#! /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