Skip to content

Instantly share code, notes, and snippets.

Created May 25, 2012 14:59
Show Gist options
  • Save anonymous/2788607 to your computer and use it in GitHub Desktop.
Save anonymous/2788607 to your computer and use it in GitHub Desktop.
init.d script for stopping and starting sunspot solr
#!/bin/sh -e
# upstart-job
#
# Symlink target for initscripts that have been converted to Upstart.
set -e
APP_PATH="/srv/rails/seek"
COMMAND="$1"
shift
case $COMMAND in
status)
;;
start|stop|restart)
$ECHO
if [ "$COMMAND" = "stop" ]; then
cd $APP_PATH && sudo -u www-data rake sunspot:solr:stop RAILS_ENV=production && cd -
elif [ "$COMMAND" = "start" ]; then
cd $APP_PATH && sudo -u www-data rake sunspot:solr:start RAILS_ENV=production && cd -
elif ["$COMMAND" = "restart" ]; then
echo "restart"
exit 0
fi
;;
esac
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment