Skip to content

Instantly share code, notes, and snippets.

@josue
Created August 21, 2014 20:13
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 josue/2043b3ba8aeff694e684 to your computer and use it in GitHub Desktop.
Save josue/2043b3ba8aeff694e684 to your computer and use it in GitHub Desktop.
Checks if client services (ElasticSearch + background jobs) are running
#!/bin/sh
CLIENT=$1
DIR_DEPLOY="/var/www/vhosts/deploy"
CLIENT_DIR="$DIR_DEPLOY/$CLIENT"
echo "- Switching to client dir: $CLIENT_DIR"
cd $CLIENT_DIR
echo
ELASTIC=`ps aux | grep java | grep elastic | grep -v grep | awk '{ print $2 }'`
if [ "$ELASTIC" != "" ]; then
echo "- Elastic is Running"
else
echo "> Starting Elastic ..."
sh app/vendors/elasticsearch-0.90.2/bin/elasticsearch
fi
echo
echo "> Restart background-jobs for client: $CLIENT"
sh app/vendors/service-background-jobs.sh restart
echo
echo "- DONE"
echo
@josue
Copy link
Author

josue commented Aug 21, 2014

Download and install within you VM:

curl -s "https://gist.githubusercontent.com/josue/2043b3ba8aeff694e684/raw/939f20ff4bd4203bf42f7848b67ab5ab338dc17f/client-startup.sh" > /usr/bin/client-startup
chmod +x /usr/bin/client-startup

Usage:

# client-startup walmart

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment