Created
May 7, 2013 15:18
-
-
Save francisdb/5533430 to your computer and use it in GitHub Desktop.
Play 2.x redeploy script TODO check: http://greweb.me/2013/05/playframework-simple-deployment-scripts/
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/sh | |
export PATH=/opt/play2:$PATH | |
cd ~/server | |
rundir=myproject | |
repo=git@server:myproject.git | |
temp=$rundir.buid.temp | |
rm -rf $temp | |
git clone $repo $temp | |
cd $temp | |
play -Dsbt.log.noformat=true clean compile stage | |
chmod +x target/start | |
cd .. | |
if [ -d $rundir ] | |
then | |
cd $rundir | |
if [ -f RUNNING_PID ] | |
then | |
pid=$(cat RUNNING_PID) | |
if [ -e /proc/$pid ] | |
then | |
echo "Stopping previous instance with pid = $pid" | |
play stop | |
while [ -e /proc/$pid ]; do sleep 0.1; done | |
else | |
echo "Previous instance with pid = $pid seems to have died" | |
fi | |
else | |
echo "No previous instance running" | |
fi | |
if [ -d logs ] | |
then | |
echo "Preserving logs" | |
cp -r logs ../$temp | |
fi | |
cd .. | |
fi | |
rm -rf $rundir | |
mv $temp $rundir | |
cd $rundir | |
./target/start -Dsbt.log.noformat=true |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment