Created
March 12, 2014 18:16
-
-
Save Ribesg/9512947 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/bash | |
cd /home/blob | |
BLOB_CMD="java -jar /home/blob/Blob.jar" | |
BLOB_PID=`ps -ef | grep "$BLOB_CMD" | grep -v grep | awk '{print $2}'` | |
if [[ $BLOB_PID != *[!0-9]* ]]; then | |
echo "Blob is running, killing Blob" | |
kill -9 $BLOB_PID | |
echo "Waiting for Blob to stop..." | |
wait $BLOB_PID | |
echo "Blob stopped" | |
else | |
echo "Blob was not running" | |
fi | |
echo "Downloading Blob.jar..." | |
wget http://ci.ribesg.fr/job/Blob/lastSuccessfulBuild/artifact/target/Blob.jar -O /home/blob/Blob.jar | |
echo "Done" | |
echo "Removing dead screens" | |
screen -wipe | |
echo "Checking 'runblob' screen existence" | |
if ! screen -list | awk '{print $1}' | grep -q "runblob"; then | |
echo "Not found, creating 'runblob' screen" | |
screen -d -m -S runblob | |
fi | |
echo "Running Blob.jar... on screen 'runblob'..." | |
screen -S runblob -p 0 -X stuff "$BLOB_CMD | |
" | |
echo "Done." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment