Skip to content

Instantly share code, notes, and snippets.

@FrancisVarga
Last active December 17, 2015 06:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save FrancisVarga/5566098 to your computer and use it in GitHub Desktop.
Save FrancisVarga/5566098 to your computer and use it in GitHub Desktop.
Some monkey stuff

#Description:

  • svn update
  • restart your solr
  • run the schema-updater
  • worker
  • solr full import

So daily job's...

Make sure that bob and alice has the same user:group and your nginx is setup also with the same user:group.

#Usage:

./monkey.sh {{your_root_alice_bob_folder}}

#!/bin/bash
echo "svn update $1"
svn update $1
if ! [ -e "$1" ]; then
echo "$1 not found" >&2
exit 1
fi
if ! [ -d "$1" ]; then
echo "$1 not a directory" >&2
exit 1
fi
echo "kill solr process"
killall java
sleep 5
# check SOLR service
clear
echo "Checking for SOLR status..."
SERVICE='java -jar start.jar'
if ps ax | grep -v grep | grep "$SERVICE" > /dev/null
then
echo "SOLR service running, everything is fine"
else
echo -e "\nSOLR is not running!"
echo -e "\nTrying to start SOLR..."
cd "$1/solr/jetty"
nohup java -jar start.jar > ../solr.out 2> ../solr.err < /dev/null &
sleep 2
# verify if started ok...
if ps ax | grep -v grep | grep "$SERVICE" > /dev/null
then
echo -e "\nSOLR started ok!"
else
echo -e "\nCould not start SOLR!"
fi
cd ../../../
fi
chmod -R 777 $1/bob/data/ $1/alice/tmp/ $1/data $1/shared/data/invoices
php $1/tools/generate_all.php
echo -e "\nUpdating Transfer Files\n"
php $1/bob/cli/index.php --env=dev --module=maintenance --controller=metadata-generator --action=transfer
echo -e "\nRunning DB migration and updating DBTables files\n"
php $1/bob/cli/index.php --env=dev --module=maintenance --controller=schema-updater --action=dbtable
php $1/bob/cli/index.php --env=dev --module=solr --controller=import --action=import
rm $1/bob/data/cache/zend_cache*
chmod -R 777 $1/bob/data/ $1/alice/tmp/ $1/data $1/shared/data/invoices
php $1/alice/worker/Worker.php
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment